I have compared gcc assembler output of
do {
// some code
} while (0);
with
do {
// some code
break;
} while (1);
The output is equal, with or without optimization but..
It’s always that way?
No experiment can prove theories, they can only show they are wrong
There is a slight difference:
Will restart the loop when
conditionis true, whereas in the} while(0);version, thecontinuewill be equivalent tobreak.If no
continueis present, then they should produce exactly the same code.