This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Bug in manual for gcc-2.95: __FUNCTION__


>>>>> 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?

Sure.

 > 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.

Jason


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]