Re:GCC Non-bugs
by plorkyeran on Sunday March 01, 2015 @05:43PM
(#9129233)
Clang 3.5 compiles that for me without warnings even with -Weverything. String literals in C (but not C++) aren't const for legacy reasons despite not being modifiable.
[ Parent
| on HN ]
Re:GCC Non-bugs
by andrewchambers on Sunday March 01, 2015 @06:10PM
(#9129332)
Sorry, I made a mistake. I think it is:
static char s[] = * &"foo";
The c standard says char array initializers are either a string, or a string surrounded by optional '{}' .
Re:GCC Non-bugs
by plorkyeran on Sunday March 01, 2015 @06:22PM
(#9129385)
-pedantic gives "warning: array initialized from parenthesized string constant" for that, so I'm guessing it's an unintended consequence of a nonstandard extension. Might be worth reporting since at the minimum the warning is wrong.