[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.

Cheers,
Mark


-------------------------------------------------------
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.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/xen-devel


 


Rackspace

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