lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] LWIP_DEBUGF


From: Bernhard 'Gustl' Bauer
Subject: Re: [lwip-users] LWIP_DEBUGF
Date: Mon, 20 Jul 2009 08:39:56 +0200
User-agent: Thunderbird 2.0.0.22 (Windows/20090605)

Eric Haver schrieb:
On Mon, Jul 20, 2009 at 1:20 AM, Bernhard 'Gustl' Bauer <address@hidden <mailto:address@hidden>> wrote:

    Hi,

    I just had a look at the define of LWIP_DEBUGF. I wonder whats the
    use of the do {} while(0) statement. Its contens is executed one
    time, so the loop can be omitted, isn't it?

    Gustl

    #define LWIP_DEBUGF(debug,x) do { \
     if ( \
       ((debug) & LWIP_DBG_ON) && \
       ((debug) & LWIP_DBG_TYPES_ON) && \
       ((s16_t)((debug) & LWIP_DBG_MASK_LEVEL) >= LWIP_DBG_MIN_LEVEL)) { \
       LWIP_PLATFORM_DIAG(x); \
       if ((debug) & LWIP_DBG_HALT) { \
         while(1); \
       } \
     } \
    } while(0)


In order to insert all those lines in a #define you have to start it with something "do{" uses the least chars, and the compiler probably edits it out.
In a non-debug scenario the line would just be:
#define LWIP_DEBUGF(debug,x)


I think simple brackets {} would do

Gustl





reply via email to

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