== is not how we compare two arrays, since that would only compare the addresses:This code even gives me a warning:
Consider the following piece of code:I compiled this program using g++ (Ubuntu 6.5.0-1ubuntu1~16.04) 6.5.0 20181026:
https://godbolt.org/z/cyBiWYI can see two 'some' literals in assembler code generated by MSVC, but only one with clang and gcc. This leads to totally different results of code execution.
Is the code below safe? It might be tempting to write code akin to this:The map is intended to be used with string literals only.
Does the C99 standard permit writing to compound literals (structs)? It seems it doesn't provide writing to literal strings. I ask about this because it says in C Programming: A Modern Approach, 2nd Edition on Page 406.
I am printing a line like thisAnd this produces the following outputI want to know why it does not give me an error as I commented half of the statement and there should be