lwip-users
[Top][All Lists]
Advanced

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

Re: AW: [lwip-users] Debug code


From: Robert
Subject: Re: AW: [lwip-users] Debug code
Date: Tue, 25 Feb 2003 09:19:29 -0500 (EST)

On Tue, 25 Feb 2003, Zschocke, Florian wrote:
> If possible, I would prefer to have different macros for conditional
> compilation and for use in DEBUGF() for the reasons stated in my first mail.
> Another way to execute real functions only when debug flags are set, is to
> use a macro similar to DEBUGF:
> 
> #define DEBUG_DO(debug, x) do { if (debug & DBG_ON) { x } } while (0)
> 
> which can be used like in the code:
> 
> DEBUG_DO( IP_DEBUG, foo(); bar(a, b) );
> 
> Florian.

I guess everyone has their coding preferences.  I will speak to the other 
point of view.

I find perfer not to use macros any more than necessary.  Macros tend to 
hide the functionality. I find that when macros are used extensively, it's 
that much harder to figure out what is actually coded, since I have to 
look in several places to figure out what code is actually being complied.

I also perfer compile time debug flags, rather than run time flags, since 
I am developing embedded systems (usually), and I need to be conservative 
with memory usage.


-- 
Best Regards,
Robert Laughlin






reply via email to

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