lwip-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: RE : RE : [lwip-devel] Can we remove pbuf_init()


From: Jonathan Larmour
Subject: Re: RE : RE : [lwip-devel] Can we remove pbuf_init()
Date: Fri, 27 Jul 2007 16:10:13 +0100
User-agent: Mozilla Thunderbird 1.0.8-1.1.fc3.4.legacy (X11/20060515)

Frédéric BERNON wrote:
#define pbuf_init() do { } while (0)

I'm always suprised about this kind of macro (the do/while(0)). Most of

time, it's generate lot of warnings. Of couse, it's perhaps
compiler-dependant. I don't understand why don't write "define
pbuf_init()" ? Can you explain me when/why such code writing ?

Some times a semi-colon by itself can be a problem, and makes some compilers warn.

Wrapping a function-like macro in do/while (0) (which allows the following-semicolon to be parsed validly) is very common, and I'm surprised any compiler warns about it.

Jifl
--
eCosCentric Limited      http://www.eCosCentric.com/     The eCos experts
Barnwell House, Barnwell Drive, Cambridge, UK.       Tel: +44 1223 245571
Registered in England and Wales: Reg No 4422071.
------["The best things in life aren't things."]------      Opinions==mine




reply via email to

[Prev in Thread] Current Thread [Next in Thread]