On Fri, 7 Aug 1998, George wrote:
> >On a side note, why would you ever want to enclose code within a "do { }
> >while (0);" block? If you've a legitimate need for a sub-block of code,
> >such as to introduce some very temporary local variables, just use your
> >braces and forget the do/while.
>
> FREE(x);
>
> becomes
>
> { free(x); x = NULL; };
>
> I forget all of the reasons, but CircleMUD's CREATE() macro does the
> do...while too.
It's necessary in this case:
if (x)
FREE(y);
else
xyzzy();
Without do/while it expands to:
if (x)
{
stuff;
}; <============= Note, extra ;
else
xyzzy();
.. which is a syntax error.
--
=============================================================================
<erwin@andreasen.com> Herlev, Denmark UNIX System Programmer
<URL:http://www.abandoned.org/drylock/> <*> (not speaking for) DDE
=============================================================================
+------------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
| http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
+------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/15/00 PST