Quantcast
Channel: User Peter - Reinstate Monica - Stack Overflow
Browsing all 223 articles
Browse latest View live

Comment by Peter - Reinstate Monica on c syntax help - very basic

The historical context is that C originally was a very weakly typed language. (For example, there were no function prototypes!) The language also acknowledged that addresses -- i.e., pointers! -- are...

View Article


Comment by Peter - Reinstate Monica on How to remove personal email from git...

Additionally, even old versions of web sites (including software repos) are often copied/cached/archived in multiple places, systematically and spontaneously. It is basically impossible to remove...

View Article


Comment by Peter - Reinstate Monica on Linker problems with Visual Studio...

Make sure you haven't mixed up the contents of main.h and main.c in the copying process. "object specified more than once", I suppose, means that your solution contains more than one definition of an...

View Article

Comment by Peter - Reinstate Monica on '\0' evaluates false, "\0" evaluates true

Note that while "\0" compares unequal to 0, *"\0" compares equal (since it is a char of value zero). (By the way, the reason you never see a string literal dereferenced except in this comment, even...

View Article

Comment by Peter - Reinstate Monica on what is a good way to change unsigned...

@PeteBecker Incidentally, it is actually the division and multiplication causing the problem here, plus the conversion to double, paradoxically. Only adding and subtracting in two's complement would...

View Article


Comment by Peter - Reinstate Monica on What is the lifetime of a string...

@mandrake From the n3096 draft, 6.4.5/6 String Literals:"The multibyte character sequence is then used to initialize an array of static storage duration" (emphasis by me).

View Article

Comment by Peter - Reinstate Monica on What are the next steps to debug why...

Apparently, you have used VS Code with some success before (you say you elaborately configured many of the extensions which seems to indicate you were using it). Is that correct?

View Article

Comment by Peter - Reinstate Monica on Why does dos2unix print to stderr?

@MarkLakata As an aside, that is probably not exactly the dos2unix function, namely for data that contains standalone carriage returns (for whatever reason). dos2unix should only affect CR-NL pairs.

View Article


Comment by Peter - Reinstate Monica on How to make + use c++ libraries in vs?

I suppose your existing project is a project producing an executable? Then you have two choices: (1) Create an entirely new project in your second solution which produces a library from the same files...

View Article


Answer by Peter - Reinstate Monica for What are the next steps to debug why...

You can delete your source code from the question, it is a distraction (or replace it with a "Hello World!"). Your problem is in the setup.You have two main ways to go about this: Use a fresh (possibly...

View Article

Comment by Peter - Reinstate Monica on Avoiding buffer overflow at scanf...

In POSIX environments (i.e., basically, -nixes and posix compatibility layers on top of Windows, notably cygwin and msys), there is an "assignment-allocation character 'm'" which instructs scanf to...

View Article

Comment by Peter - Reinstate Monica on How do I compile code that uses both...

@HolyBlackCat I suppose the two are related and normally used together ("#define PHYSAC_STANDALONE * Avoid raylib.h header inclusion in this file." from...

View Article

Comment by Peter - Reinstate Monica on How do I compile code that uses both...

@Caner-sagopaninsagkolu OK, that's a link error. The code sees the declarations, the compiler produces the proper calls, but the linker cannot resolve them. You need to add the libraries or .c files...

View Article


Comment by Peter - Reinstate Monica on enter a substring and a string and...

s and r must be defined as true arrays, not just as pointers. And when passing them to scanf, don't take their addresses; they are converted to pointers automatically.

View Article

Comment by Peter - Reinstate Monica on Is there a way to count members of a...

@Gene I don't know boost.pfr either, but it appears to me that if I create a specialization for, say, 10 elements I kinda know how many I have, don't I? ;-) Also, iterating can simply be done...

View Article


Answer by Peter - Reinstate Monica for git push --set-upstream to GitHub not...

As mentioned in the comments (thanks to matt, phd), this is possible with GitLab but not with github. The OP understandably but wrongly expected feature parity :).

View Article

Comment by Peter - Reinstate Monica on std :: gmtime does not return UTC time

@PasserBy is a bit mean. Of course: The C standard library is part of C++, which makes calls to gmtime() and localtime() perfectly valid C++; it's just not the preferred way, by some. Simply mention...

View Article


Comment by Peter - Reinstate Monica on Outputting Date and Time in C++ using...

@BjörnSundin For me, it doesn't work with gcc 13, 14 or trunk, and neither with clang trunk (godbolt.org/z/YsabTseYK). Can you confirm?

View Article

Comment by Peter - Reinstate Monica on Protecting secrets in memory dumps

I think Ian's remark goes a long way, and is prudent advice anyway: If all asserts are your own you can make sure to scrub the sensitive information before asserting. Admittedly, that will complicate...

View Article

Comment by Peter - Reinstate Monica on C++20 and newer - what's the best way...

In particular, short of reflection there is no way to avoid (wordy and error-prone) repetition of names for producing strings from identifiers, except using the preprocessor.

View Article
Browsing all 223 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>