Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 12 Mar 1998 21:51:07 -0800 (PST)
From:      Simon Shapiro <shimon@simon-shapiro.org>
To:        "Jonathan M. Bresler" <jmb@FreeBSD.ORG>
Cc:        freebsd-current@FreeBSD.ORG
Subject:   Re: A question about sys/sys/queue.h
Message-ID:  <XFMail.980312215107.shimon@simon-shapiro.org>
In-Reply-To: <199803130339.TAA10294@hub.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?XFMail.980312215107.shimon>