Re: __FUNCTION__ and debug.

From: Francesco Chemolli <kinkie-ml@dont-contact.us>
Date: 05 Nov 2002 11:11:22 +0100

Henrik Nordstrom <hno@marasystems.com> writes:

> On Tuesday 05 November 2002 09.00, Francesco Chemolli wrote:
>
> > Why not just using a function and hinting the compiler to inline
> > it? Inline-hints are less intrusive than macro varargs (BTW: I used
> > macro varargs for the debug-messages in some helpers, with #ifdef
> > trickery to fall back to not emitting the debug messages if I
> > wasn't sure that the compiler supported them - more a style
> > exercise than something useful, but still...)
>
> Because the code needs to be expanded in place for __FILE__, __LINE__,
> or __func__ to give anything interesting.. In a inlined function
> these would all give the location where the inlined function is
> defined, not the location of the debug message.
>
> As we can not use macro varargs we have to pass the extra arguments in
> another way. Global variables suggested. And the same syntax as for
> debug() to allow for quick "macro inlined" level filter code.
>
> After some consideration I agree on the use of __FILE__ if
> __FUNCTION__ is not available. Drawback is that __FILE__ is a little
> overly verbose (full path), but the called log function should be
> able to work around this with not too much effort.

Sure. See the helpers I wrote (they might rely on the path separator
being '/')..

-- 
	kinkie (kinkie-ml [at] libero [dot] it)
	Random fortune, unrelated to the message:
Anyone who uses the phrase "easy as taking candy from a baby" has never
tried taking candy from a baby.
		-- Robin Hood
Received on Tue Nov 05 2002 - 03:10:42 MST

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