> > #ifdef LOG_ON
> > printf("%s\n", __PRETTY_FUNCTION__);
> > #endif
> > }
> from wherre #ifdef LOG_ON and #endif comes ?????
> ????????
>
they should come with
PRINT_FUNC() if the macro is correct(thats what i'm asking for)
what i want is when i want i can compile with -D LOG_ON
then c preprocessor would insert nothing for PRINT_FUNC()
where as otherwise it would insert
printf("%s\n", __PRETTY_FUNCTION__);
consider i have PRINT_FUNC1() as below
#define PRINT_FUNC1()\
printf("%s\n", __PRETTY_FUNCTION__)
so when i have
func()
{
PRINT_FUNC1();
}
it will ultimately be
func()
{
printf("%s\n", __PRETTY_FUNCTION__);
}
so if i have
#define PRINT_FUNC2()\
#ifdef LOG_ON
printf("%s\n", __PRETTY_FUNCTION__);
#endif
and i call
func()
{
PRINT_FUNC2();
}
it should be
func()
{
#ifdef LOG_ON
printf("%s\n", __PRETTY_FUNCTION__);
#endif
}
got my point?
--- In [email protected], "Ahmed Shabana" <[EMAIL PROTECTED]> wrote:
>
> On 8/17/07, Indika Bandara <[EMAIL PROTECTED]> wrote:
> >
> >
> >
> >
> >
> >
> > hi,
> >
> > i want something like
> >
> > #define PRINT_FUNC()\
> > printf("%s\n", __PRETTY_FUNCTION__)
> >
> > so when i call
> > func()
> > {
> > PRINT_FUNC();
> > }
> >
> > the preprocessor should insert something like
> >
> > func()
> > {
> > #ifdef LOG_ON
> > printf("%s\n", __PRETTY_FUNCTION__);
> > #endif
> > }
> from wherre #ifdef LOG_ON and #endif comes ?????
> ????????
>
> the macro must subsitute "REPLACED" with it's definition only
>
> >
> >
> >
> >
> >
> >
> > howerver above macro is unable to do such a thing. cos
> >
> > #define PRINT_FUNC()\
> > #ifdef LOG_ON \
> > printf("%s\n", __PRETTY_FUNCTION__);\
> > #endif
> >
> > is wrong macro.
> why you did that like this
>
>
>
> #ifdef LOG_ON
> #define PRINT_FUNC() printf("%s\n", __PRETTY_FUNCTION__)
> #endif
>