__FUNCTION__, __FUNCDNAME__ and __FUNCSIG__ macros

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
I posted this a while ago, but it seems to have disappeared from the forums.  As has the reply from <font color="#808080 Ayman Shoukry </font>asking if it was still an issue.
It is...
None of these macros work!  Im using the __FUNCTION__ macro to output the name of a function when tracing generic run-time errors, and it always expands to "__FSTREXP __FUNCTION__" .  All the others fail in a similar way - and I had such high hopes for using them!
The fact that it does compile means that theres something wrong with the definition, or I guess it could be the way that Im using it:  Im stringizing the expansion and widening it (my app is pure unicode output) with the little widening macro trick thats in the MSDN: <font color="#ff0000" size=2>
<font face="Courier New, Courier, Monospace" color="#000000 #define</font></font><font face="Courier New, Courier, Monospace <font color="#000000 <font size=2> WIDEN2</font><font size=2>(</font><font size=2>x</font><font size=2>)</font><font size=2> L </font><font size=2>## </font><font size=2>#x </font></font></font><font size=2>
<font face="Courier New, Courier, Monospace" color="#000000 #define</font></font><font face="Courier New, Courier, Monospace <font color="#000000 <font color="#000000 <font size=2> WIDEN</font><font size=2>(</font><font size=2>x</font><font size=2>)</font><font size=2> WIDEN2</font><font size=2>(</font><font size=2>x</font><font color="#ffff00" size=2><font color="#000000 )</font></font></font></font></font>
Then Ive defined another macro,
<font face="Courier New, Courier, Monospace" size=2># define __WFUNC__ WIDEN(__FUNCTION__)</font>
I have tried taking out the widening macro, and the result is the same.
The editor cant actually resolve the definition (right-click->view definition)for __FUNCTION__, either, yet the tooltip displayed for the macro definition is #define __FUNCTION__() - but as Ive already mentioned that doesnt tally with what I actually get.
Could it be that the compiler is incorrectly setting a temporary string that is accessed by __FUNCTION__ when it expands?
Or is there something more obvious to this?  Im not using the /ep /p or compiler options (which suppress the macros output), so thats not the problem either.
Any ideas would be greatly appreciated.

View the full article
 
Back
Top