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: Long Long Int and gcc2.95


James McKelvey <mckelvey@fafnir.com> writes:

| gcc 2.95:
| 
| In iostream.h, long long int operators are guarded by:
| 
| #if defined(__GNUC__)
|     __extension__ ostream& operator<<(long long n);
|     __extension__ ostream& operator<<(unsigned long long n);
| #endif
| 
| But in the .cc file, by:
| 
| #if defined(__GNUC__) && !defined(__STRICT_ANSI__)
| ostream& ostream::operator<<(long long n)
| 
| Is there a reason for this inconsistency? I'd like to use long long int with  
| -ansi, so I specify -Wno-long-long. But that no longer works, because the  
| code is no longer in the library. It worked OK in egcs 1.1.2.

Well, since the actual trend is toward ISO C++ conformance, I'd say
that if you turn on -ansi then you can't use 'long long'.  So the
obvious fix I see is 
	- in the header:

#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
    __extension__ ostream& operator<<(long long n);
    __extension__ ostream& operator<<(unsigned long long n);
#endif

	- in the .cc
#if defined(__GNUC__) 
    __extension__ ostream& ostream::operator<<(long long n);
   ostream& ostream::operator<<(long long n)
  // ....
#endif

-- Gaby


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