Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
From: Franz Gaehler <gaehler@itap.physik.uni-stuttgart.de>
Subject: bug in cpp used by cc?
Date: 1998/02/12	[thread overview]
Message-ID: <34E304A2.E18B39D@itap.physik.uni-stuttgart.de> (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



             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 Franz Gaehler [this message]
1998-02-12  5:00 ` bug in cpp used by cc? Steve Peltz
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