[asterisk-dev] Re: [asterisk-commits] rizzo: trunk r51312 - /trunk/include/asterisk/strings.h

Luigi Rizzo rizzo at icir.org
Fri Jan 19 15:25:58 MST 2007


On Fri, Jan 19, 2007 at 03:59:09PM -0600, Kevin P. Fleming wrote:
> asterisk-commits at lists.digium.com wrote:
> > +/*
> > + * AST_INLINE_API() is a macro that takes a block of code as an argument.
> > + * Using preprocessor #directives in the argument is not supported by all
> > + * compilers, and it is a bit of an obfuscation anyways, so avoid it.
> > + * As a workaround, define a macro that produces either its argument
> > + * or nothing, and use that instead of #ifdef/#endif within the
> > + * argument to AST_INLINE_API().
> > + */
> > +#if defined(DEBUG_THREADLOCALS)
> > +#define	_DB1(x)	x
> > +#else
> > +#define _DB1(x)
> > +#endif
> > +
> 
> Is there any reason to call this _DB1 instead of DEBUG_THREADLOCAL or

none except from trying to avoid clashes with other names and
keep the name short to reduce the visual clutter.

It is like the P() thing that was used in the transition between
K&R and modern C versions with prototypes.

> something similar? Obscure macro names (even when they are only used a
> few lines later) really don't help anyone trying to understand the code.

I hoped the explaination just above was enough.
Actually a bigger style bug is that i did not #undef the
macro once done with it.

	cheers
	luigi


More information about the asterisk-dev mailing list