Date: Thu, 12 Mar 1998 19:39:39 -0800 (PST) From: "Jonathan M. Bresler" <jmb> To: shimon@simon-shapiro.org Cc: freebsd-current@FreeBSD.ORG Subject: Re: A question about sys/sys/queue.h Message-ID: <199803130339.TAA10294@hub.freebsd.org> In-Reply-To: <XFMail.980312191745.shimon@simon-shapiro.org> from Simon Shapiro at "Mar 12, 98 07:17:45 pm"
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199803130339.TAA10294>