[Top][All Lists]

[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 (Windows/20090605)

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


    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?


    #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)) { \
       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


reply via email to

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