Asm style
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 17 lines · [email protected] wrote:
Quoted 4 lines · Giacomo Catenazzi
not ANSI C. The trailing \ is understood only in marco definitions (and outside strings)
gcc begs to differ
/*
z.c*/
#include <stdio.h>int main(void)
{ printf("This is a string\n\ with continuation characters\n"); return 0; }
Quoted 9 lines
$ gcc -Wall -pedantic -ansi z.c -o z [silence]Remove the \ and you get
z.c:5: warning: string constant runs past end of line
z.c: In function `main':
z.c:5: warning: ANSI C forbids newline in string constant
gcc should warn in both case (when calling it with -pedantic -ansi). But forget my comment:
Talking about ANSI C for asm construct doen't make much sense.
If gcc people will maintain (in long future) the syntax of trailing \ + NL, I agree to use it into kernel.
giacomo
Quoted 3 lines · Giacomo Catenazzi
gcc should warn in both case (when calling it with -pedantic -ansi). But forget my comment:
Talking about ANSI C for asm construct doen't make much sense.
It should not warn.
Please read ISO C99 5.1.1.2:
2. Each instance of a backslash character (\) immediately followed by a new-line character is deleted, splicing physical source lines to form logical source lines. Only the last backslash on any physical source line shall be eligible for being part of such a splice. A source file that is not empty shall end in a new-line character, which shall not be immediately preceded by a backslash character before any such splicing takes place.
This happens even before tokenizing (and before macro expansion too).
Jakub