lkml.org 
[lkml]   [2001]   [Nov]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Asm style
Giacomo Catenazzi wrote:
> Ben Collins wrote:
> > There's also:
> >
> > asm("\
> > cmd r,r\n\
> > lbl: cmd r,r\n\
> > cmd r,r\n" : spec : spec);
> >
> >
> > Or something similar (the trailing "\" added for continuation). Probably
> > the easiest way to patch existing asm.
>
> 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;
}

$ 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

You are correct in thinking it is something to do with pre-processor -
it deals with these continuation lines eg,

$ gcc -E -Wall -pedantic -ansi z.c

Gives
[snip stdio etc]
int main(void)
{
printf("This is a string\nwith continuation characters\n");

return 0;
}

--
Nick Craig-Wood
ncw@axis.demon.co.uk
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:13    [W:0.036 / U:0.540 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site