[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] avr-gcc does not throw diagnostics on undefinedescape
From: |
Jan Waclawek |
Subject: |
Re: [avr-gcc-list] avr-gcc does not throw diagnostics on undefinedescape sequences |
Date: |
Thu, 17 May 2012 14:52:22 +0200 |
>const char c[] = "\%";
>
>compile
>
>$ gcc file.c -std=c99 -fsyntax-only -pedantic-errors
>
>file.c:1:18: unknown escape sequence '\%'
>
>Tested with gcc 3.4 and gcc 4.7
>
>> My understanding of C99, 6.4.4.4, especially footnote 65, indicates,
>> that the \% sequence should result in compiler error.
>
>Yes.
>
>> Comments, please?
>
>Read "C Dialect Options" and what -std=c99 means
>
>http://gcc.gnu.org/onlinedocs/gcc/C-Dialect-Options.html
>
Indeed. So, this particular "error" is revealed only if -pedantic-whatever is
used.
One learns something new every day. Thanks, Johann.
Meantime, I also consulted the Derek Jones book, which for this particular
issue says, among other interesting things, this:
"It is possible that an occurrence of such a character sequence will cause a
violation of syntax to occur,
which will in turn require a diagnostic to be generated. However,
implementations are not required to issue a
diagnostic just because a footnote (which is not non-normative) says one is
required."
Two new things learned today... :-)
Jan