Bug in manual for gcc-2.95: __FUNCTION__

Jason Merrill jason@cygnus.com
Sun Oct 31 23:33:00 GMT 1999

>>>>> Martin v Loewis <martin@mira.isdn.cs.tu-berlin.de> writes:

 >> In g++, __FUNCTION__ is a variable, not a string literal.  That change was
 >> necessary to support templates.

 > I would add the sentence

 > In @code{C++}, @code{__FUNCTION__} and @code{__PRETTY_FUNCTION__} are
 > variables, declared in the same way as @code{__func__}.

 > With that change, is it ok to install the patch?


 > I just noticed that there is a number of minor nits, in the behaviour
 > of gcc compared to the proposed documentation:

 > a) __func__ is treated the same way as __FUNCTION__ in cc1.  As a
 >   result, concatenation is supported for __func__, whereas it would be
 >   ill-formed according to C99.

 > b) The value of these builtin identifiers is an array with a default
 >    length of 201. The default is not used when the value is longer
 >    than that, or when the -Wlarger-than- option is used. As a result,
 >    the program

 > #include <stdio.h>

 > int halloballo()
 > {
 >   return sizeof(__FUNCTION__);
 > }

 > int main()
 > {
 >   printf("%d\n",halloballo());
 > }

 >    prints "201" when compiled as a C++ program, but "11" when compiled
 >    as a C program.

 > Should these nits be documented, or should they be considered as bugs?

Bugs, I would think.


More information about the Gcc-patches mailing list