Project Home
Project Home
Source Code
Source Code
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
BroadcastCommunity.qnx.com will be offline from May 31 6:00pm until June 2 12:00AM for upcoming system upgrades. For more information please go to https://community.qnx.com/sf/discussion/do/listPosts/projects.bazaar/discussion.bazaar.topc28418
Forum Topic - GCC4.2.4 no longer defines the __func__ macro?: (4 Items)
   
GCC4.2.4 no longer defines the __func__ macro?  
Hi list,
does the gcc 4.2.4 no longer defines the __func__ macro?
I used that for debug/trace outputs within each function but it seems it diappeared in gcc4.2.4.
Re: GCC4.2.4 no longer defines the __func__ macro?  
Peter Weber wrote:
> Hi list,
> does the gcc 4.2.4 no longer defines the __func__ macro?
> I used that for debug/trace outputs within each function but it seems it diappeared in gcc4.2.4.

It is no longer treated as a macro but as a variable.

$ cat func.c
#include <stdio.h>

int foo() {
          printf("%s\n",__func__);
}

int main() {
         printf("%s\n",__func__);
         foo();
}

$ qcc -V4.2.4,gcc_ntox86 func.c
$ ./a.out
main
foo

Regards,

Ryan Mansfield
Re: GCC4.2.4 no longer defines the __func__ macro?  
so, things like that will no longer work right?

const char *fn = __func__ "hello";

not a big thing but rewriting all that stuff is a huge amount of work.

Thanks,
Peter
Re: GCC4.2.4 no longer defines the __func__ macro?  
Peter Weber wrote:
> so, things like that will no longer work right?
> 
> const char *fn = __func__ "hello";
> 
> not a big thing but rewriting all that stuff is a huge amount of work.

Correct. gcc is just following c99.

Regards,

Ryan Mansfield