2007/4/2, Manfred Rebentisch <[EMAIL PROTECTED]>:
Thank you Filipe,

Am Sonntag, 1. April 2007 23:20 schrieb Filipe Sousa:
>
> what about using basename()?
>
I do use a Macro:

#define CP_PREFIX(varname, functionname)      \
        static const char* varname  = __FILE__ ":" functionname

and use it:

int func(void)
{
   CP_PREFIX(prefix, "func");
   return printf("%s: error msg x\n", prefix);
}

The line with return and printf is only the example of use. I use other
functions.
With this macro you cannot use a function.

Another idea?

May be.

May be you can use predefined
C99  __func__ or GCC specific __FUNCTION__ macros
and then you should be able to use:

printf("%s:%s error msg x\n", basename(__FILE__), __FUNCTION__);

nevertheless my man page says that basename could modify
its argument which may gives you unexpected result in this case...



--
Erk
_______________________________________________
CMake mailing list
[email protected]
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to