Hacker News new | ask | show | jobs
by zambal 2851 days ago
You are correct. At least the do... while statement is a common c macro trick to make sure a macro has its own scope. The idea is that a compiler will optimize the do....while statement away, so it does not have any runtime overhead.

The wile...while(0) statement is new for me (didn't know this is actually legal syntax), but I suspect it's done for similar reasons.

1 comments

> didn't know this is actually legal syntax

It looks like some unusual looping syntax; but in fact these are just two normal while loops one after another.