Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
* bug in cpp used by cc?
@ 1998-02-12  5:00 Franz Gaehler
  1998-02-12  5:00 ` Steve Peltz
  0 siblings, 1 reply; 3+ messages in thread
From: Franz Gaehler @ 1998-02-12  5:00 UTC (permalink / raw)



I'm having a problem with the macro preprocessor used by DEC C (V5.2-033 
on Digital UNIX V4.0 (Rev. 564.32)). Consider the file prog.c containing
the following code:

    typedef unsigned long int * * Bag;
    #define ADDR_OBJ        PTR_BAG
    #define PTR_BAG(bag)    (*(Bag**)(bag))

    void CleanBlistCopy ( Bag list )
    {
        ADDR_OBJ(list)[0] = ADDR_OBJ( ADDR_OBJ(list)[0] )[0];
    }

If I do "cc -E prog.c", the body of the function CleanBlistCopy becomes:

    (*(Bag**)(list))[0] = (*(Bag**)(ADDR_OBJ(list)[0]))[0];

In other words, one of the macros is not expanded. On the other hand,
if I do "cpp prog.c -", the macro is expanded as it should:

    (*(Bag**)(list))[0] = (*(Bag**)( (*(Bag**)(list))[0] ))[0];

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?

Franz G\"ahler

---
Franz G\"ahler 
ITAP, University of Stuttgart
gaehler@itap.physik.uni-stuttgart.de



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1998-02-16  5:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1998-02-12  5:00 bug in cpp used by cc? Franz Gaehler
1998-02-12  5:00 ` Steve Peltz
1998-02-16  5:00   ` Jeff Sullivan

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