This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: question about stray '\' in program when using i386-elf-gcc



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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]