From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1164f8,aeece6781a2f9e62 X-Google-Attributes: gid1164f8,public From: peltz@jaka.ece.uiuc.edu (Steve Peltz) Subject: Re: bug in cpp used by cc? Date: 1998/02/12 Message-ID: <6bveqn$3tl$1@jaka.ece.uiuc.edu>#1/1 X-Deja-AN: 324501530 References: <34E304A2.E18B39D@itap.physik.uni-stuttgart.de> Organization: NovaNET Learning, Inc. Newsgroups: comp.sys.dec In article <34E304A2.E18B39D@itap.physik.uni-stuttgart.de>, Franz Gaehler 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