Skip to contentSkip to conversation

macro _set_base - "do - while(0)" question

DISCUSSION Abdel 1 participant 1 message Jan 2, 2008

lore
Share & tools
lore

Abdel

author
#0 lore raw

2008/1/2, DervishD <[email protected]>:

Quoted 10 lines

* Abdel <[email protected]> dixit:

Quoted 4 lines

In file include/asm-i386/system.h, _set_base and _set_limit use an useless do ... while(0)

Why is this needed ?

Google for "do while swallow semicolon". This looks like an useless and weird construction but it is very useful when it comes to macros (you can define variables inside the block and you can use your macro as any other statement, it won't swallow the semicolon).

thanks to all for your responses :)

Signature · 2 lines
Abdel
http://draconux.free.fr/