Re: __FUNCTION__ and debug.

From: Henrik Nordström <hno@dont-contact.us>
Date: Mon, 28 Oct 2002 00:50:22 +0100 (CET)

On Mon, 28 Oct 2002, Henrik Nordström wrote:

> Note: As far as I know macro varargs is a GCC extension, not a standard
> language construct.. do not expect code written with macro varargs
> constructs to be very portable to other compilers than GCC.

Correction: There is also a varargs macro form defined in C99. I do not
know if a equvalence exists in the C++ standard for preprocessors.

The form used in fix_ranges is from what I know entirely GCC specific and
uses at least two GCC extensions, where none is really needed other than
for clarity.. (named varags variable, and ## to get rid of extra commas),

Example of a C99 standard syntax of a trace / debug vararg macro:

#define trace(SECTION, LEVEL, ...)
        ((_db_level = (LEVEL)) > debugLevels[SECTION]) ? (void) 0 : \
        _db_print_trace(__FILE__, __LINE__, __FUNCTION__, __VA_ARGS__)

Regards
Henrik
Received on Sun Oct 27 2002 - 16:50:24 MST

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:17:01 MST