Date: Fri, 05 Jun 1998 06:38:04 -0500 From: "Chris Csanady" <cc@swing.ca.sandia.gov> To: Marino Ladavac <lada@pc8811.gud.siemens.at> Cc: Greg Lehey <grog@lemis.com>, freebsd-hackers@FreeBSD.ORG Subject: Re: style(9) error? Message-ID: <199806051138.GAA02086@swing.ca.sandia.gov> In-Reply-To: Your message of "Fri, 05 Jun 1998 11:26:17 %2B0200." <XFMail.980605112617.lada@pc8811.gud.siemens.at>
next in thread | previous in thread | raw e-mail | index | archive | help
[...]
>>> As far as I can tell, it is impossible to put a do loop in a if statement,
>>> or anything else. Is this correct?
>>
>> No.
>
>We have a case of misunderstanding here: the original poster asked whether
>
> if (MACRO(x, y))
> foo();
> else
> bar();
Thank you.. This is indeed what I was thinking, and how I read the man
page. I actually did some further looking, and it seems that it is
possble to do this, only using something slightly different.
#define BLA(x) ({ (x); })
This actually works in a conditional, assignment, etc.. evaluating the
block to the last statement as I was expecting. Is there a reason why
the do {} while(0) would be preffered over this?
I appologize for the misunderstanding, I really didn't mean to make such
a big deal over this nuance of C.
Chris
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199806051138.GAA02086>
