[Zope] Backslash as line continuation in C (Unix)

J M Cerqueira Esteves jmce@artenumerica.com
Wed, 13 Sep 2000 14:12:59 +0100


On Tue, Sep 12, 2000 at 09:45:53PM -0700, Hung Jung Lu wrote:

> I am trying to build a third-party utility in Linux. I ran into troubles in 
> the compilation process because of the usage of backslash \ as line 
> continuation. (This is used in #def preprocessor macro statements.) When I 
> remove the backslashes and join the lines, it compiles fine. (I know 
> backslashes are fine in Windows Visual C++.)

Do the lines really END with a backslash?  There should be no problems
with standard C constructs, but for the backslash to work as expected it
really must be the last character in the line; there must be no white
space characters after it.  If your files are properly processed by some
Windows compiler and have problems under Linux, I can think of two
explanations:

Either the Windows compiler is being "tolerant" with improper white
space after the "\"...

Or your source files get white space after the "\" only when transported
to Linux; this may happen if under Linux the lines of your source files
still end with CR-LF (carriage return, line feed) as they do in Windows, 
instead of only LF (the expected end of line character in Unix).  

For all the other lines, perhaps the compiler doesn't care about the
extra CRs (they just count as white space), but they may become critical for
line continuation: where you are expecting a line to end with "\", your
Linux compiler may in fact see

   \ CR LF     [the last (pre-LF) line character is CR, not "\" as expected]

instead of the proper sequence
   
   \ LF        [the last (pre-LF) line character is "\", marking continuation]

If you have in Linux a small program called "fromdos", try to convert
your source files with it; the same conversion of line endings can
also be easily made with "tr", for instance.

-- 
 jmce: +351 919838775 ~ http://artenumerica.com/ ~ http://artenumerica.org/