[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference turris::c_plus_plus

Title:C++
Notice:Read 1.* and use keywords (e.g. SHOW KEY/FULL KIT_CXX_VAX_VMS)
Moderator:DECCXX::AMARTIN
Created:Fri Nov 06 1987
Last Modified:Thu Jun 05 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:3604
Total number of notes:18242

3450.0. "stream functions for types in ints.h" by OPCO::TSG_PLL (Live and Sweaty) Thu Feb 13 1997 19:00

Hi,

   Am I doing something wrong?  I would like to be able to do things like

#include ints
.
.
.
    uint32  status;

    status = sys$get...;
    cout << "Status = " << status << endl;
.
.

But it does not compile.  I always need to cast the status to int
   cout << "Status = " << (int)status << endl;

Is there an easy way to achieve this, because I seem to forget the cast very
often?

C++ V5.5
OpenVMS Alpha V7.1

Any help with this minor irritation appreciated
Paul
T.RTitleUserPersonal
Name
DateLines
3450.1special int types and iostreamsDECC::J_WARDFri Feb 14 1997 10:0614
I'm not sure why the special int types were never added
to the set of overloaded operator << and operator >> in
the iostream class library, perhaps it was because they
are non-standard types and we wanted to keep the library
consistent across all platforms... we'll consider it...
In the meantime, you can always define your own
operator <<, i.e.:

// add this to your own code
inline ostream& operator<<(ostream& os, uint32 i)
{
        return os << (int) i;
}