ftp.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2002/04/21/08:30:04

X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-bounces using -f
From: "Alex Vinokur" <alexvn AT bigfoot DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: uclock_t & gcc 3.0.4 on Windows-2000
Date: Sun, 21 Apr 2002 15:17:15 +0200
Organization: Scopus
Lines: 208
Message-ID: <a9uahn$6ao8i$1@ID-79865.news.dfncis.de>
NNTP-Posting-Host: gateway.scopus.net (62.90.123.5)
X-Trace: fu-berlin.de 1019391352 6643986 62.90.123.5 (16 [79865])
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2600.0000
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

=========================================================
GNU CPP version 3.0.4 (cpplib) (80386, BSD syntax)
GNU C++ version 3.0.4 (djgpp) compiled by GNU C version 3.0.4.
Configured with: ../configure i586-pc-msdosdjgpp --prefix=/dev/env/DJDIR --disable-nls
Thread model: single

Windows-2000
=========================================================


Here is a program, results of the running and a question about uclock_t.
P.S. According the time.h file :
typedef long long uclock_t;

###### Header file ######
// File xxx.h
#ifndef _XXX_H
#define _XXX_H

#include <iostream>
#include <assert.h>
#include <time.h>
using namespace std;

//=============================
class ClassMeter
//=============================
{
  private:
    uclock_t start_uclock_;
    uclock_t end_uclock_;

  public:
    // Constructor-0
    ClassMeter()
    {
      start_uclock_ = uclock();
    }

    // Destructor
    ~ClassMeter()
    {
      end_uclock_ = uclock();

      cout << "start_uclock_ = " << start_uclock_ << endl;
      cout << "end_uclock_   = " << end_uclock_ << endl;

      assert (start_uclock_ >= 0);
      assert (end_uclock_ >= 0);
      assert (start_uclock_ <= end_uclock_);
    }

};

#endif // _XXX_H


#########################

###### Source file ######
// File xxx.c
#include "xxx.h"

int main()
{
#define TOTAL_TIMES 250
  for (int i = 0; i < TOTAL_TIMES; i++)
  {
    ClassMeter t;
  }

  return 0;

}

#########################


###### Compilation ######

%gpp xxx.c

#########################


######## Running ########

start_uclock_ = 0
end_uclock_   = 17
start_uclock_ = 1099
end_uclock_   = 1115
start_uclock_ = 2011
end_uclock_   = 2025
start_uclock_ = 2910
end_uclock_   = 2924
start_uclock_ = 3813
end_uclock_   = 3828
start_uclock_ = 4718
end_uclock_   = 4732
start_uclock_ = 5642
end_uclock_   = 5656
start_uclock_ = 6527
end_uclock_   = 6540
start_uclock_ = 7422
end_uclock_   = 7436
start_uclock_ = 8306
end_uclock_   = 8319
start_uclock_ = 9183
end_uclock_   = 9196
start_uclock_ = 10067
end_uclock_   = 10081
start_uclock_ = 10993
end_uclock_   = 11007
start_uclock_ = 11958
end_uclock_   = 11972
start_uclock_ = 12897
end_uclock_   = 12910
start_uclock_ = 13826
end_uclock_   = 13840
start_uclock_ = 14754
end_uclock_   = 14769
start_uclock_ = 15676
end_uclock_   = 15691
start_uclock_ = 16601
end_uclock_   = 16615
start_uclock_ = 17524
end_uclock_   = 17539
start_uclock_ = 18441
end_uclock_   = 18454
start_uclock_ = 19387
end_uclock_   = 19401
start_uclock_ = 20321
end_uclock_   = 20335
start_uclock_ = 21256
end_uclock_   = 21269
start_uclock_ = 22190
end_uclock_   = 22205
start_uclock_ = 23120
end_uclock_   = 23134
start_uclock_ = 24057
end_uclock_   = 24072
start_uclock_ = 24991
end_uclock_   = 25006
start_uclock_ = 25928
end_uclock_   = 25941
start_uclock_ = 26864
end_uclock_   = 26878
start_uclock_ = 27795
end_uclock_   = 27809
start_uclock_ = 28731
end_uclock_   = 28746
start_uclock_ = 29664
end_uclock_   = 29679
start_uclock_ = 30601
end_uclock_   = 30615
start_uclock_ = 31537
end_uclock_   = 31551
start_uclock_ = 32467
end_uclock_   = 32481
start_uclock_ = 33425
end_uclock_   = 33439
start_uclock_ = 34372
end_uclock_   = 34385
start_uclock_ = 35292
end_uclock_   = 35306
start_uclock_ = -29321
end_uclock_   = -29307
Assertion failed at xxx.h line 34: start_uclock_ >= 0
Exiting due to signal SIGABRT
Raised at eip=00007c8e
eax=000bf9ec ebx=00000120 ecx=00000000 edx=00000000 esi=00000054 edi=0003fb60
ebp=000bfa98 esp=000bf9e8 program=D:\_T02_P~1\a.exe
cs: sel=01f7  base=01e80000  limit=000cffff
ds: sel=01ff  base=01e80000  limit=000cffff
es: sel=01ff  base=01e80000  limit=000cffff
fs: sel=01cf  base=00012150  limit=0000ffff
gs: sel=020f  base=00000000  limit=0010ffff
ss: sel=01ff  base=01e80000  limit=000cffff
App stack: [000bfb60..0003fb60]  Exceptn stack: [0003fabc..0003db7c]

Call frame traceback EIPs:
  0x00007bb4
  0x00007c8e
  0x000057f9
  0x00017cc6
  0x0000161b
  0x00005278
#########################

We can see that behavior of uclock_t is not long-long-behavior.

Any explanation?

Thanks in advance.



--
====================
  Alex Vinokur
    http://up.to/alexvn
    http://go.to/alexv_math
    mailto:alexvn AT bigfoot DOT com
    mailto:alexvn AT go DOT to
  ====================



- Raw text -


  webmaster     delorie software   privacy  
  Copyright 2019   by DJ Delorie     Updated Jul 2019