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: Frédéric BERNON
Subject: RE : RE : RE : [lwip-devel] Can we remove pbuf_init()
Date: Fri, 27 Jul 2007 17:21:30 +0200

With such code, like for LWIP_DEBUGF, I got with TCS5.01 (NXP compiler for 
Nexperia DSP) :

"src\api\api_lib.c", line 706: warning: controlling expression is constant
    LWIP_DEBUGF(API_LIB_DEBUG, ("netconn_send: sending %d bytes\n", 
buf->p->tot_len));
    ^

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

Most of time, it only true for semi-colon inside a typedef/struct (that's why 
there is a such strange thing for IP_PCB_ADDRHINT in ip.h). In code, this is 
not a problem. Last, this is not the usual coding style on most of lwIP files 
(see sys.h; tcp.h, etc..), except in one or two cases: debug.h and... tcp.h 
(which seems to use the both). My preference would be to change these 
exceptions to the more generic use in current code.


====================================
Frédéric BERNON 
HYMATOM SA 
Chef de projet informatique 
Microsoft Certified Professional 
Tél. : +33 (0)4-67-87-61-10 
Fax. : +33 (0)4-67-70-85-44 
Email : address@hidden 
Web Site : http://www.hymatom.fr 
====================================
P Avant d'imprimer, penser à l'environnement
 


-----Message d'origine-----
De : address@hidden [mailto:address@hidden De la part de Jonathan Larmour
Envoyé : vendredi 27 juillet 2007 17:10
À : lwip-devel
Objet : Re: RE : RE : [lwip-devel] Can we remove pbuf_init()


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


_______________________________________________
lwip-devel mailing list
address@hidden http://lists.nongnu.org/mailman/listinfo/lwip-devel

Attachment: Frédéric BERNON.vcf
Description: Frédéric BERNON.vcf


reply via email to

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