bug-glibc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bug in bits/stdio.h when used with GCC-3


From: James Youngman
Subject: Re: Bug in bits/stdio.h when used with GCC-3
Date: 25 Aug 2001 18:12:10 +0100
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7

Andreas Jaeger <address@hidden> writes:

> James Youngman <address@hidden> writes:
> 
> > Description of problem:
> >
> > When compiling programs with optimisation, GCC defines the
> > __USE_EXTERN_INLINES macro.  The /usr/include/bits/stdio.h header
> > #defines a macro for printf in this case.  However, while this is
> > probably fine for C, it breaks C++ programs where objects can have
> > member functions called printf.  This macro is also not defined if the
> > GCC version is earlier than 2.97.   Here is the offending code :-
> 
> The printf macro has been removed in glibc 2.2.4.

OK; thanks. 

> Nevertheless the C library is allowed to define printf as a macro in C
> - and also all other functions.

Yes, I agree that that is the case for the C language.  I am talking
about the C++ language.  In C++, more than one function with the same
name can exist. 

My understanding is that the following is a conforming C++ program,
which should work :-

  #include <stdio.h>
  class foo { public: int printf(const char *fmt, ...); };
  int main (int argc, char *argv[]) { return 0; }

Do you disagree?   

-- 
James Youngman
Manchester, UK.  +44 161 226 7339
PGP (GPG) key ID for <address@hidden> is 64A95EE5 (F1B83152).



reply via email to

[Prev in Thread] Current Thread [Next in Thread]