Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!ists!stpl!bbm!darcy From: darcy@bbm.UUCP (D'Arcy Cain) Newsgroups: comp.lang.c Subject: Re: Nested Macros Message-ID: <819@bbm.UUCP> Date: 22 Nov 89 21:15:13 GMT References: Reply-To: darcy@druid.UUCP (darcy) Organization: BBM Bureau of Measurement, Toronto Lines: 23 In article jb3o+@andrew.cmu.edu (Jon Allen Boone) writes: >#define DEBUG 1 > >#define DB(X) #ifdef (DEBUG) printf(X) > I would have coded the above as follows just because I don't like smart-alecky code (or more accurately I'm afraid some compiler won't :-).) #ifdef DEBUG #define DB(X) printf(X) #else #define DB(X) This however still has the problem that printf has a variable number of arguments so you have to call it like this: DB(("Error: Result code is %d\n", res)); /* note double parentheses */ and that is probably your error. D'Arcy