|
From: | Georg-Johann Lay |
Subject: | Re: [avr-gcc-list] avr-gcc does not throw diagnostics on undefined escape sequences |
Date: | Thu, 17 May 2012 10:51:52 +0200 |
User-agent: | Thunderbird 2.0.0.24 (Windows/20100228) |
Jan Waclawek schrieb:
The following code: #include <stdio.h> int a = 1; int b = 1; int c = 1; int d = 1; int e = 1; int f = 1; char buffer[30]; int main(void) { sprintf(buffer, "\%d/\%d/\%02d \%d:\%02d:\%02d", a, b, c, d, e, f); printf(buffer); } compiles cleanly with avr-gcc (I tried both 4.2.2 and 4.7.1), even with -std=c99.
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 Johann
[Prev in Thread] | Current Thread | [Next in Thread] |