do ... while(0) in macros

lange92 at 2067.resnet.uni.edu lange92 at 2067.resnet.uni.edu
Wed Aug 8 02:15:21 UTC 2001


Well, I don't profess to know definite RTEMS-specific answers, but as was
pointed out in one of my classes, a do-while loop always executes at least
once, even if the condition if false. It executes before evaluation.

On the other hand, I won't comment on the form, but I do know that it is
entirely possible in C to redefine 0, potentially producing a loop here
that executes multiple times.

DanL

On Wed, 8 Aug 2001, CARERI/SED wrote:

> There are many macros in RTEMS written like the following code:
>
>   do {
>   } while (0)
>
> Could anybody explain the purpose of the "do ... while(0)" ?




More information about the users mailing list