lwip-devel
[Top][All Lists]
Advanced

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

Re: [lwip-devel] RFC: debug and asserts


From: David Vrabel
Subject: Re: [lwip-devel] RFC: debug and asserts
Date: Tue, 04 Nov 2003 10:39:15 +0000
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030624

For readability and consistency (some places have it either with or
without ifdefs). LWIP_DEBUGF evaluates to something like if (constant
& flag_constant) { do things} so if constant is 0 I expect any
compiler to optimize away the construct anyway.

This is standard stuff but I've seen people forget it so...

You need to wrap the if() {} in some dummy loop construct as otherwise
you could mess up any else's that follow.

e.g.,

#define LWIP_DEBUG(when, args) \
    while(1) { \
        if( when ) { /* debug message here */ } \
    }

David Vrabel
--
David Vrabel, Design Engineer

Arcom                         Tel: +44 (0)1223 411200 ext. 3233
Clifton Road                  Fax: +44 (0)1223 403400
Cambridge CB1 7EA             E-mail: address@hidden
UK                            Web: http://www.arcom.com/


_____________________________________________________________________
The message in this transmission is sent in confidence for the attention of the 
addressee only and should not be disclosed to any other party. Unauthorised 
recipients are requested to preserve this confidentiality. Please advise the 
sender if the addressee is not resident at the receiving end.

This message has been checked for all viruses by MessageLabs Virus Control 
Centre.




reply via email to

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