do ... while(0) in macros
CARERI/SED
careri at public.sta.net.cn
Wed Aug 8 07:06:19 UTC 2001
There are many macros in RTEMS written like the following code:
do { \
unsigned32 _stack; \
\
if ( (_isr) ) (_the_context)->eflags = CPU_EFLAGS_INTERRUPTS_OFF; \
else (_the_context)->eflags = CPU_EFLAGS_INTERRUPTS_ON; \
\
_stack = ((unsigned32)(_stack_base)) + (_size) - 4; \
\
*((proc_ptr *)(_stack)) = (_entry_point); \
(_the_context)->ebp = (void *) _stack; \
(_the_context)->esp = (void *) _stack; \
} while (0)
Could anybody explain the purpose of the "do ... while(0)" ?
Thanks in advance,
Guo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/users/attachments/20010808/d51499b7/attachment-0001.html>
More information about the users
mailing list