| www.delorie.com/archives/browse.cgi | search |
| Message-ID: | <094001bfe77c$a0314e10$4f0cf5d1@wt.net> |
| From: | "RH" <rdh AT wt DOT net> |
| To: | <pgcc AT delorie DOT com> |
| References: | <D1674834F25BD3118B3208002BB90CD450DEBF AT yen DOT crl DOT dec DOT com> <3964C164 DOT 22648267 AT mira DOT net> |
| Subject: | Re: What's up with this?? |
| Date: | Thu, 6 Jul 2000 13:01:42 -0600 |
| MIME-Version: | 1.0 |
| X-Priority: | 3 |
| X-MSMail-Priority: | Normal |
| X-Mailer: | Microsoft Outlook Express 5.00.2314.1300 |
| X-MimeOLE: | Produced By Microsoft MimeOLE V5.00.2314.1300 |
| X-MIME-Autoconverted: | from quoted-printable to 8bit by delorie.com id PAA20934 |
| Reply-To: | pgcc AT delorie DOT com |
That's what I would have thought. Adding braces should be enough?
Consider a macro like this:
#define doit() { call_something(); call_something_else(); }
And then this:
if ()
doit();
Becomes
if ()
{ call_something(); call_something_else();};
----- Original Message -----
From: Antony Suter <antony AT mira DOT net>
To: <pgcc AT delorie DOT com>
Sent: Thursday, July 06, 2000 11:27 AM
Subject: Re: What's up with this??
> What is the two line explanation as to why it cant be:-
>
> { \
> /* stuff */ \
> }
>
> George France wrote:
> >
> > It is not moot; it is so that inline macro's expand properly. See the gcc or
> > linux-kernel archives for more details.
> >
> > -----Original Message-----
> > From: RH [mailto:rdh AT wt DOT net]
> >
> > I have been wondering why in the world is code mostly in macros of the form.
> >
> > do {
> > /*stuff*/
> > while(0);
> >
> > I don't get this... Seems stupid and pointless. So I would just like an
> > explination and if its moot now a days, why don't people start removing
> > them...
>
> --
> - Antony Suter (antony AT mira DOT net) 'Examiner'
> - "And how do you store the nuclear equivalent of the universal
> solvent?"
>
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |