[DGD] Re: lf in #define

Erwin Harte harte at is-here.com
Thu Jan 8 04:36:14 CET 2004


On Thu, Jan 08, 2004 at 03:30:12AM +0000, Robert Forshaw wrote:
> >From: Erwin Harte <harte at is-here.com>
> >On Thu, Jan 08, 2004 at 12:52:17AM +0000, Robert Forshaw wrote:
> >> I am trying to do a #define statement spanning several lines, by using
> >> backslash to represent where the line ends. Unfortunately, this doesn't
> >> work! I keep getting syntax errors! How should I do it?
> >
> >1. Telling us the actual input and the actual error would help.
> 
> Okay, but its basically ANY code that uses this method. I'll give you the 
> example code I cut&pasted which didn't work:
> 
> #define LONG_DEFINE  "beginning of string \
>                      and end of the same"
> 
> ^ doesn't work. Gives a syntax error on the second line.

Ah, gotcha.  Strings cannot contain newlines and since you are
effectively adding newlines into your #define, the LPC parser
complains.  Try this instead:

    # define LONG_DEFINE  "beginning of string" +\
	 		  "and end of the same"

> >2. DGD can be picky about MS-DOS style newlines, especially inside
> >   defines.
> 
> Well I don't think emacs does insert MS-DOS style newlines. I was 
> originally using visual C but I re-edited it in emacs and I think that 
> would have removed the carriage return.

I suspect you're right.  Hope the above suggestions helps.

Cheers,

Erwin.
-- 
Erwin Harte <harte at is-here.com>
_________________________________________________________________
List config page:  http://list.imaginary.com/mailman/listinfo/dgd



More information about the DGD mailing list