[asterisk-dev] 0006889: [patch] Convert ast_verbose into macros

Olle E Johansson oej at edvina.net
Thu Apr 6 01:54:38 MST 2006


5 apr 2006 kl. 23.25 skrev Tilghman Lesher:

> On Wednesday 05 April 2006 15:05, casper at casper.org.ua wrote:
>>> But failing to terminate ast_verbose strings with a newline is a
>>> feature, not a bug.  It allows us to send a full line with multiple
>>> calls to ast_verbose.  It is intentionally done that way.
>>
>> There are other macros to handle this:
>> #define AST_VERBOSE_RAW(level, args, ...) \
>>         if (option_verbose >= level) ; else \
>>                 ast_verbose(args, ## __VA_ARGS__);
>>
>> #define AST_VERBOSE_RAW_IF(level, cond, args, ...) \
>>         if ((option_verbose >= level) && (cond)) ; else \
>>                 ast_verbose(args, ## __VA_ARGS__);
>
> Why is that else in there?  Doesn't that do the opposite?
>
>> That way anybody is pretty sure it's done intentionally.
>>
>> Other possibility is not to use macros for such cases.
>
> It seems like a solution looking for a problem, rather than the
> other way around.  I still don't see the utility, nor the need.  IMHO,
> this actually makes the code more error-prone, not less.

Yes, and adding too many macros makes the code very hard
to understand for new programmers. After thinking about it,
I don't see a need for this,

/Olle



More information about the asterisk-dev mailing list