Actually, optimization should eliminate the extra while(0) if the compiler is paying attention. GCC is nice, since it does optimize these things, but of course, GCC allows inline functions too, as long as -O (more precisely, -O3) is given on the command line, and provided you haven't specified -ansi (and even in that case, you can still use
__inline__ to identify an inline function).
On the other hand, some less intelligent compilers just do the job of translating into assembly and don't recognize inefficient (or even stupid) code. Maybe this encourages programmers to do more optimizing by hand, but then again, maybe it just shows that those who wrote the compiler didn't have the motivation to add in these spiffy features.
Either way, this is a clever trick, if even nothing more than a workaround solution to the problem of not being able to write whole functions as macros. (That, in itself, may be looked at as a problem of C, and is considered harmful by some; I personally believe that macros are a powerful feature of the language, and can be beneficial when they're not abused.)