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]
Other format: [Raw text]

Re: Bug in sample code in the gcc manual


Op vr 14-03-2003, om 06:48 schreef David Bristow:
> There is a small bug in the example code demonstrating the difference in 
> output between __FUNCTION__ and __PRETTY_FUNCTION__ in the "Function Names 
> as Strings" section of the C extensions chapter of the gcc manual.  The code 
> as written does not compile -- the "a::sub(int i)" member function is 
> missing a return type, giving an error (from the RH8 gcc-3.2-7, but it looks 
> like it's a fairly generic error): 
> 
> ISO C++ forbids declaration of `sub' with no type 
> 
> The documentation on your web site of the latest release of gcc still lists 
> the example code with the above error, it's not just in what came with 
> gcc-3.2-7. 

Gee, funny nobody spotted this before, thanks :-)

I've commited this as obvious on the mainline.  Does the "obvious" rule
apply to 3.3 as well?

Greetz
Steven

2003-03-14  Steven Bosscher  <steven at gcc dot gnu dot org>

        * doc/extend.texi (Function Names): Make the example compilable.

Index: extend.texi
===================================================================
RCS file: /cvs/gcc/gcc/gcc/doc/extend.texi,v
retrieving revision 1.125
diff -c -3 -p -r1.125 extend.texi
*** extend.texi	2 Mar 2003 01:42:58 -0000	1.125
--- extend.texi	14 Mar 2003 07:54:13 -0000
*************** extern int printf (char *, ...);
*** 4316,4322 ****
  
  class a @{
   public:
!   sub (int i)
      @{
        printf ("__FUNCTION__ = %s\n", __FUNCTION__);
        printf ("__PRETTY_FUNCTION__ = %s\n", __PRETTY_FUNCTION__);
--- 4316,4322 ----
  
  class a @{
   public:
!   void sub (int i)
      @{
        printf ("__FUNCTION__ = %s\n", __FUNCTION__);
        printf ("__PRETTY_FUNCTION__ = %s\n", __PRETTY_FUNCTION__);



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