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

Tilghman Lesher tilghman at mail.jeffandtilghman.com
Wed Apr 5 14:25:12 MST 2006


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.

-- 
Tilghman



More information about the asterisk-dev mailing list