LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

What happened to __FUNCTION__?

Solved!
Go to solution

I am working on updating a CVI 8.5.1 program to CVI 2013 and have run into the issue that the __FUNCTION__ macro no longer works. There is quite a bit of code that depended on the string concatenation that would happen when you put __FUNCTION__ next to another quoted string

(ex printf(__FUNCTION__", this used to compile");

It now complains that it expected ')'.

 

When did this change again? They had fixed it in 8.5.1 (8.5 was broke also).

0 Kudos
Message 1 of 2
(6,139 Views)
Solution
Accepted by topic author ljstrick

The LabWindows compiler has been replaced with clang. Clang is designed to be highly compatible with GCC. The GCC documentation (https://gcc.gnu.org/onlinedocs/gcc-3.3/gcc/Function-Names.html) states:

 

GCC 3.2 will handle __FUNCTION__ and __PRETTY_FUNCTION__ the same way as __func__. __func__ is defined by the ISO standard C99:

     The identifier __func__ is implicitly declared by the translator as if, immediately following the opening brace of each function  definition, the declaration
    

          static const char __func__[] = "function-name";
     
     appeared, where function-name is the name of the lexically-enclosing function.  This name is the unadorned name of the function.
    
By this definition, __func__ is a variable, not a string literal. In particular, __func__ does not catenate with other string literals. 

 

 

Message 2 of 2
(6,122 Views)