On Thu, 2011-04-07 at 12:04 -0500, kevin diggs wrote: > On Thu, Apr 7, 2011 at 2:55 AM, Benjamin Herrenschmidt > <b...@kernel.crashing.org> wrote: > > On Wed, 2011-04-06 at 14:01 +0100, Evan Lavelle wrote: > >> #define MY_ASSERT(expr) if(!(expr)) BUG() > > > > Make it > > > > #define MY_ASSERT(expr) do { if .... } while(0) > > > > To ensure it has proper single statement semantics in C. > > > So THAT'S why they do this!!!!!! Now I just have to figure out what > 'proper single statement semantics' means!
Thing what happens without the do { ... } while(0) if you have code that looks like: if (enable_debug) MY_ASSERT(foo); else something_else; Ben. _______________________________________________ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev