Path: utzoo!attcan!uunet!samsung!sol.ctr.columbia.edu!cica!iuvax!news!cartan!ndmath!nstar!inland!allebrandi From: allebrandi@inland.com (Tom Allebrandi) Newsgroups: comp.os.msdos.programmer Subject: Re: #define thisneatmacro Message-ID: <159.271eb448@inland.com> Date: 19 Oct 90 08:07:36 GMT References: <9286@helios.TAMU.EDU> Organization: Inland Steel Research Labs; East Chicago, IN Lines: 42 In article <9286@helios.TAMU.EDU>, ctl8588@rigel.tamu.edu (LAUGHLIN, CHET) writes: > I tried useing the following macro, with some success... > > #define drawch(A,B,C) {gotoxy(A,B); cput(C);} > > however, the following code won't work...compiler doesn't like > the extra ; at the end of drawch... > > if (cond) > drawch(x,y,ch); > else > printf("ICK!\n"); > Think about what you are telling the compiler. What you have typed above is exactly equivalent to if (cond) {gotoxy(A,B); cput(C);}; (1) else printf("ICK!\n"); The way I read the language definition in K&R, line (1) is not legal syntax. However, this is legal: {{gotoxy(A,B); cput(C);};} meaning that you should do this: if (cond) {drawch(x,y,ch);} ... Another approach would be to define your macro as #define drawch(A,B,C) gotoxy(A,B), cput(C) --- Tom Tom Allebrandi | Vice-char and mail guru, VMSnet WG, DECUS VAX SIG Inland Steel Research Labs | Internet: allebrandi@inland.com East Chicago, IN | UUCP: ...!uunet!inland!allebrandi 219 399 6306 | DECUServe: allebrandi BIX: ta2