Why do compilers allow string literals not to be const?
问题 And where are literals in memory exactly? (see examples below) I cannot modify a literal, so it would supposedly be a const char*, although the compiler let me use a char* for it, I have no warnings even with most of the compiler flags. Whereas an implicit cast of a const char* type to a char* type gives me a warning, see below (tested on GCC, but it behaves similarly on VC++2010). Also, if I modify the value of a const char (with a trick below where GCC would better give me a warning for),