| |
comp.lang.c |
In article <47295485.0110190255.7f389...@posting.google.com> > I understood that __FUNCTION__ is a preprocessor macro, which >#ifndef __LINE__ >#ifndef __FILE__ >#ifndef __FUNCTION__ >int assert(int bool, int line, char *file, char *fun) --
sob...@eudoramail.com "Sobhan Vezzu" writes:
>will substitute a file name. Similar to __FILE__ and __LINE__.
define __FILE__ and __LINE__
>prints as unknown why?
>__FUNCTION__. When I comment #ifndef __FUNCTION block it prints the
>file name.
will expand to the name of the function containing it. If it isn't
in a function then it won't be able to expand to anything. The new
C standard C99 does introduce something like this but it is called
__func__ and it is *not* a macro, it acts like the name of a static
variable within that function.
>#include <errno.h>
>#define __LINE__ 0
>#endif
>#define __FILE__ "Unknown"
>#endif
>#define __FUNCTION__ "Unknown"
>#endif
to define in your code.
-----------------------------------------
Lawrence Kirby | f...@genesis.demon.co.uk
Wilts, England | 70734....@compuserve.com
-----------------------------------------