Re: OSS sound
David Hammerton <[email protected]>
| Newsgroups | gmane.comp.emulators.winex.devel |
|---|---|
| Organization | TransGaming Technologies |
| Message-ID | <[email protected]> |
The do/while swallows the the ';'.
If you have it like you wrote, this would fail:
if (foo)
CLEAR_OMR(omr);
else
something_else();
because there will be two statements after the if.
In the case of the do/while, the ';' gets swallowed up.. so that above
case would work, making the macro call seem more natural.
See:
http://developer.apple.com/documentation/DeveloperTools/gcc-3.3/cpp/Swallowing-the-Semicolon.html#Swallowing%20the%20Semicolon
for more info.
Cheers,
David
> Yes, I understand how macros work. My question is why have a do/while loop that
> will always exit at the first test? Why not write the macros as:
>
> ...
> #define CLEAR_OMR(omr) { int x = 0; read((omr)->msg_pipe[0], &x, sizeof(x)); }
> #define RESET_OMR(omr) { }
> ...
>
> It just seems like a strange thing to do.
>
> rob
--
David Hammerton
TransGaming Technologies
[email protected]
http://www.transgaming.com/
*Let the games begin*
-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive? Does it
help you create better code? SHARE THE LOVE, and help us help
YOU! Click Here: http://sourceforge.net/donate/