From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1164f8,aeece6781a2f9e62,start X-Google-Attributes: gid1164f8,public From: Franz Gaehler Subject: bug in cpp used by cc? Date: 1998/02/12 Message-ID: <34E304A2.E18B39D@itap.physik.uni-stuttgart.de>#1/1 X-Deja-AN: 324443400 Content-Transfer-Encoding: 7bit Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Organization: ITAP, University of Stuttgart Xcanpos: shelf.01/199802261701!0023929495 Newsgroups: comp.sys.dec 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