From owner-freebsd-current Thu Mar 12 19:39:45 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id TAA10314 for freebsd-current-outgoing; Thu, 12 Mar 1998 19:39:45 -0800 (PST) (envelope-from owner-freebsd-current@FreeBSD.ORG) Received: (from jmb@localhost) by hub.freebsd.org (8.8.8/8.8.8) id TAA10294; Thu, 12 Mar 1998 19:39:40 -0800 (PST) (envelope-from jmb) From: "Jonathan M. Bresler" Message-Id: <199803130339.TAA10294@hub.freebsd.org> Subject: Re: A question about sys/sys/queue.h In-Reply-To: from Simon Shapiro at "Mar 12, 98 07:17:45 pm" To: shimon@simon-shapiro.org Date: Thu, 12 Mar 1998 19:39:39 -0800 (PST) Cc: freebsd-current@FreeBSD.ORG X-Mailer: ELM [version 2.4ME+ PL32 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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;" ^ 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