How to enable the long long IOSTREAM-OPs (gcc-3.0.1, Unixware 7.0.1)

Schlick, Jochen schlick@comsoft.de
Mon Oct 1 03:31:00 GMT 2001


Hi,

Is it possible to enable (or get to work) the
iostream operators for long long under Unixware 7.0.1


I tried to use the _GLIBCPP_USE_LONG_LONG define but this
produces only coredumps.




//////////////testprog.cpp//////////////////////////////////////
#define _GLIBCPP_USE_LONG_LONG

#include <limits>
#include <numeric>
#include <iostream>

using namespace std;


typedef numeric_limits<long long>            LONGLONGLIM;
typedef numeric_limits<unsigned long long>   LONGLONGLIM;

int main()
{
   cout << "long long : " << endl;
   cout << " dig: "<< LONGLONGLIM::digits << endl;
   cout << " min: "<< LONGLONGLIM::min() << endl;
   cout << " max: "<< LONGLONGLIM::max() << endl;
   cout << endl;

   cout << "usigned long long : " << endl;
   cout << " dig: "<< ULONGLONGLIM::digits << endl;
   cout << " min: "<< ULONGLONGLIM::min() << endl;
   cout << " max: "<< ULONGLONGLIM::max() << endl;
   cout << endl;
}
////////////////////////////////////////////////////////////////


here the output of testprog.cpp:

long long : 
 dig: 63
 min: 0
 max: 4294967295                        <---- (???)

usigned long long : 
 dig: 64
 min: Segmentation Fault (core dumped)

/////////////////////////////////////////////////////////////////

stacktrace:
Core image of longlong (process p1) created
Created core image(s) of 1 thread(s) for process p1
CORE FILE [_idoprnt]
Signal: sigsegv Fault address: 0x8048000
        0xbffa76fc (_idoprnt+8764:)      repz movsl  (%esi), (%edi)
debug> stack
Stack Trace for p1.1, Program longlong
*[0] _idoprnt(presumed: 0x8046e8c, 0x8046f10, 0x8046ed8)        [0xbffa76fc]
 [1] sprintf(0x8046f20, 0x8046f10, 0x6, 0, 0, 0x80a2684, 0x1, 0x1)      [0xbffb63a9]
 [2] ?()        [0x8066172]



-- 
 =================================================
        Jochen Schlick           }}}\/{{{
 Email: schlick_@_comsoft_de
 =================================================



More information about the Gcc-help mailing list