Crossfire Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Removing #ifdef's



Peter Mardahl wrote:
> Well, how about we remove lots of #ifdef's in general?  They DO make
> the code more confusing.

  I agree.  And even in places where different behaviour may desired, I prefer
the use of command line switches to change that (with perhaps a define in
config.h to set default behaviour).  The later is more friendly to binary
distribution, but also will generate more reliable code as at least all the code
gets compiled - right now, some global changes may be made but some areas within
#ifdefs are not verified to work, or even compile, simply because there are so
many potential #ifdefs to check against.


> As to all the #ifdef's about logging, I think it would
> be cleaner to do it like this:
> 
> *never* #ifdef logging commands in the code in general.
> 
> Make the LOG command smart so that it'll do all the ifs
> rather than bury them all over the code.
> 
> Here's an example call:
> 
> Log(llevDebug,LOG_ATTACK_DEBUG|LOG_MAGIC_DEBUG,"Error message here");
> and hav ethe log function decide whether to log attack-debug messages
> and/or LOG_MAGIC_DEBUG messages.

 that was pretty much what I was thinking/trying to propose in my last message. 
I would think we could lose the _DEBUG at the end, since we already have the
llevDebug at the start, suggesting it is a debug message and not an error or
info message.