Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
From: peltz@jaka.ece.uiuc.edu (Steve Peltz)
Subject: Re: bug in cpp used by cc?
Date: 1998/02/12	[thread overview]
Message-ID: <6bveqn$3tl$1@jaka.ece.uiuc.edu> (raw)
In-Reply-To: 34E304A2.E18B39D@itap.physik.uni-stuttgart.de


In article <34E304A2.E18B39D@itap.physik.uni-stuttgart.de>,
Franz Gaehler  <gaehler@itap.physik.uni-stuttgart.de> wrote:
>    typedef unsigned long int * * Bag;
>    #define ADDR_OBJ        PTR_BAG
>    #define PTR_BAG(bag)    (*(Bag**)(bag))

>I suspect that the behaviour of cc should be called a bug. Or is this 
>the expected behaviour? Are there any fixes or work arounds known?

Yeah, I'd call it a bug as well. Doesn't happen with the old (OSF) C compiler,
does happen with the DEC C compiler (-migrate on older systems).

A work-around would be:

#define ADDR_OBJ(x)	PTR_BAG(x)

Another work-around would be to run your program through cpp directly, rather
than let the C compiler do it. You may want to pass the -no_cpp flag to the
C compiler to not bother trying to expand it again, but since the pre-
processing is built in it probably doesn't save you anything.

Another bug I found is that it doesn't swallow pre-processor directives if
the line before it has a continuation (actually, it was a bug in my code,
but the DEC C compiler didn't catch it; found it using gcc):

#if 0
#define WOOF woof \
#else
#define XYZ xyz
#endif

WOOF
XYZ

SHOULD produce:

WOOF
XYZ

DOES produce:

WOOF
xyz



  reply	other threads:[~1998-02-12  5:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-02-12  5:00 bug in cpp used by cc? Franz Gaehler
1998-02-12  5:00 ` Steve Peltz [this message]
1998-02-16  5:00   ` Jeff Sullivan
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox