Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
From: Dirk Grunwald <grunwald@foobar.cs.colorado.edu>
Subject: longlong support in DEC C++
Date: 1997/08/28	[thread overview]
Message-ID: <qxp67spvnh3.fsf@foobar.cs.colorado.edu> (raw)




When I try to compile the following..

--------------------
#include <stdlib.h>
#include <stream.h>
void
main()
{
    long long t_longlong = 30;
    cout << "And the magic number is " << t_longlong << "\n";
}
--------------------

using DEC C++, I get the following error. G++ compiles it just fine.
This is DEC C++ V5.4 and 5.5 (I'm wrapping the error message for
readability).

[foobar-75] cxx -c simple.C
cxx: Error: simple.C, line 10: In this statement, the argument list
         "cout<<"And the magic number is "<<t_longlong"
         matches more than one "ostream::operator <<".
    cout << "And the magic number is " << t_longlong << "\n";
----^
[foobar-76] g++ -c simple.C

Obviously, the DEC C++ compiler is treating 'long long' as something
else internally. I can find no stream converter for 'long long'. If I
provide the function....

inline ostream& operator<<(ostream& s, long long t)
{
  s << (long) t;
  return s;
}

then all works as desired. Is "long long" a "long long" child in DEC
C++? I realize it's an abomination, but you'd like to have consistency
in the language. This will become increasingly important as people
move applicatsion from Sun's idea of a 64-bit architecture to the
Alpha.


-- 
Dirk Grunwald                 Assoc. Prof, Univ. of Colorado at Boulder



                 reply	other threads:[~1997-08-28  4:00 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox