Path: utzoo!utgpu!watserv1!watmath!att!occrsh!uokmax!apple!usc!snorkelwacker!mit-eddie!uw-beaver!sumax!thebes!polari!6sigma2 From: 6sigma2@polari.UUCP (Brian Matthews) Newsgroups: comp.std.c Subject: Re: Question on backslash in string in define Message-ID: <2483@polari.UUCP> Date: 11 Sep 90 00:31:45 GMT References: <2480@polari.UUCP> <1990Sep9.224807.17776@zoo.toronto.edu> Organization: Seattle Online Public Unix (206) 328-4944 Lines: 26 In article <1990Sep9.224807.17776@zoo.toronto.edu> henry@zoo.toronto.edu (Henry Spencer) writes: |In article <2480@polari.UUCP> 6sigma2@polari.UUCP (Brian Matthews) writes: |>#define STR "12\ |>34" |>char *x = STR; |It is perfectly well defined. The backslash-newline sequence vanishes |completely before anything else is done. x points to "1234". Yep. I thought that was the case, but I couldn't find it anywhere in the standard. I didn't think of looking in the translation phase section, where it's spelled out very clearly. Sigh. Anyways, just for everyone's information, the Microsoft C compiler that comes with SCO's version of Unix botches this. It appears to escape the first character of the next line (so in fact, my question wasn't even correct.) Thus, #define STR "1\ \n2\n" defines STR as "1\\n2\n", where it should define it as "1\n2\n" Another of the vast array of reasons to avoid Microsoft C... -- Brian L. Matthews blm@6sceng.UUCP