This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: question about stray '\' in program when using i386-elf-gcc
- To: ecos-discuss at sources dot redhat dot com
- Subject: Re: [ECOS] question about stray '\' in program when using i386-elf-gcc
- From: Hugo Tyson <hmt at redhat dot com>
- Date: 06 Nov 2001 11:36:42 +0000
- References: <20011105024323.67045.qmail@web14706.mail.yahoo.com>
- Reply-To: ecos-discuss at sources dot redhat dot com
li hui <lhbyron@yahoo.com> writes:
> I meet a strange problem, when I use '\' in my program
> to indicate a newline, compiler(i386-elf-gcc under
> CYGWIN) promote error that stray '\' in program.
> I was puzzled by this error.
Chances are this is a newlines problem. Your sources are mounted in text
mode rather than binary mode, or vice versa; I don't understand nasty
windows-isms myself, but I know that can be the source of that problem.
The underlying cause is that you wrote (for example)
#define FRED(x) \
x++
and you want the compiler to see (as a series of bytes)
......[NL]#define FRED(x) \[NL][TAB]x++[NL]......
(newline then tab between "\" and "x") but it is actually seeing
....[CR][NL]#define FRED(x) \[CR][NL][TAB]x++[CR][NL]......
because the file is being presented with DOS line endings (CR-LF) rather
than just an LF. And \[CR] is not a continuation symbol to the compiler.
I suspect a more detailed answer will be available in the archives of this
list.
HTH,
- Huge