[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] debugging frustration

> if (ptr == null)
>     ;
> else
>     *ptr = 2
> The only problem is when the macro has some code (AFAIK).

Using a "do {} while(0)" makes the compilation fail if you use the macro 
somewhere it wouldn't be valid when debugging enabled.  Otherwise, you could 
end up developing with debugging turned off and not notice the macro is being 
misused until someone turns it on.

Having a dummy statement helps catch this kind of error.


SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
Xen-devel mailing list



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.