Article View: gnu.gcc.help
Article #42114Overriding a CPP macro?
From: Richard Jones
Date: Fri, 12 Jan 1996 00:00
Date: Fri, 12 Jan 1996 00:00
35 lines
1453 bytes
1453 bytes
I'm trying to redefine a cpp macro, but using the old definition. I've got a macro defined: #define m1(a,b) /* some hidden definition of m1 */ and in another file, I want to redefine m1 in terms of the old (unknown) definition. Two obvious ways would be: #define old_m1(a,b) m1(a,b) #undef m1 #define m1(a,b) (old_m1(a,b)+1) or: #define new_m1(a,b) (m1(a,b)+1) #undef m1 #define m1(a,b) new_m1(a,b) But neither works as expected. I've tried variations using the macro: #define expand(a) a which according to the Gnu info page for (Gnu) cpp should expand the argument first. However, no known combination works. What's the way to do this? Surely this is an obvious thing to want to do, so there must be some simple point I'm missing? Rich. -- "The real tight interface is between the book and the reader - the world of the book is plugged right into your brain, never mind the [virtual reality] bodysuit" -- from The Age of Missing Information, by Bill McKibben.
Technical Details
Message-ID:
<4d68dt$t7j@oak78.doc.ic.ac.uk>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 11318c,26097f87a5d2c03e,start X-Google-Attributes: gid11318c,public From: rwmj@doc.ic.ac.uk (Richard Jones) Subject: Overriding a CPP macro? Date: 1996/01/12 Message-ID: <4d68dt$t7j@oak78.doc.ic.ac.uk> X-Deja-AN: 135045618 distribution: world organization: Dept. of Computing, Imperial College, University of London, UK. keywords: cpp macro newsgroups: gnu.gcc.help