From owner-freebsd-current Thu Mar 12 21:43:50 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id VAA27731 for freebsd-current-outgoing; Thu, 12 Mar 1998 21:43:50 -0800 (PST) (envelope-from owner-freebsd-current@FreeBSD.ORG) Received: from sendero.simon-shapiro.org (sendero-fddi.Simon-Shapiro.ORG [206.190.148.2]) by hub.freebsd.org (8.8.8/8.8.8) with SMTP id VAA27719 for ; Thu, 12 Mar 1998 21:43:46 -0800 (PST) (envelope-from shimon@sendero-fxp0.simon-shapiro.org) Received: (qmail 15190 invoked by uid 1000); 13 Mar 1998 05:51:08 -0000 Message-ID: X-Mailer: XFMail 1.3-alpha-030698 [p0] on FreeBSD X-Priority: 3 (Normal) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit MIME-Version: 1.0 In-Reply-To: <199803130339.TAA10294@hub.freebsd.org> Date: Thu, 12 Mar 1998 21:51:07 -0800 (PST) Reply-To: shimon@simon-shapiro.org Organization: The Simon Shapiro Foundation From: Simon Shapiro To: "Jonathan M. Bresler" Subject: Re: A question about sys/sys/queue.h Cc: freebsd-current@FreeBSD.ORG Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On 13-Mar-98 Jonathan M. Bresler wrote: > Simon Shapiro wrote: >> Why was the definition of some macros changed >> from: >> >> #define FOO { ... } >> >> to: >> >> #define FOO do { ... } while(0) >> >> I thought these are the same... >> > > the difference lies in how you use them. > in the first case one writes "FOO" > in the second "FOO;" cute. Wonder what the compiled code looks like... Thanx > ^ > make a macro act more like a statement. > > imagine the code around the macro > rather then the macro itself. > > first saw this in _C_traps_and_pitfalls_ > by andrew koenig (sp?) > jmb > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-current" in the body of the message ---------- Sincerely Yours, Simon Shapiro Shimon@Simon-Shapiro.ORG Voice: 503.799.2313 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message