www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2002/02/14/04:15:22

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: string.at() and error report
Date: Thu, 14 Feb 2002 11:10:19 +0200
Lines: 75
Message-ID: <3C6B7EFA.E8054982@bigfoot.com>
NNTP-Posting-Host: 62.90.123.5
Mime-Version: 1.0
X-Trace: fu-berlin.de 1013677814 48698280 62.90.123.5 (16 [79865])
X-Mailer: Mozilla 4.7 [en] (Win98; I)
X-Accept-Language: en
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

===============================================================
Windows98
gpp : GNU C++ version 2.95.3 20010315/djgpp (release) (djgpp)
      compiled by GNU C version 2.95.3 20010315/djgpp (release).
===============================================================

Here is a program that contains an error (index > string's size).

Because the at() method is used then
  * if pos < size(), returns the element at position pos in this string.

  * otherwise, an out_of_range exception is thrown

However the error report doesn't contain
  file name and line number of erroneous situation.

Is the any possibility to localize the error place ?

// ############# C++ Code : BEGIN #############
// File aaa.c

#include <string>
int main ()
{
string s1 ("ABCDE");
  s1.at(9) = 0;  // Here is an error : index must be < 5
  return 0;
}

// ############# C++ Code : END ###############




// ############# Compilation : BEGIN ##########

Abort!
Exiting due to signal SIGABRT
Raised at eip=000186e6
eax=000b00a4 ebx=00000120 ecx=00000000 edx=00019070 esi=000b03f8
edi=000b0348
ebp=000b0150 esp=000b00a0 program=D:\FOO_C_~1\_TESTS\A.EXE
cs: sel=00ef  base=86ca2000  limit=000bffff
ds: sel=00f7  base=86ca2000  limit=000bffff
es: sel=00f7  base=86ca2000  limit=000bffff
fs: sel=00c7  base=00019070  limit=0000ffff
gs: sel=0107  base=00000000  limit=0010ffff
ss: sel=00f7  base=86ca2000  limit=000bffff
App stack: [000b0438..00030438]  Exceptn stack: [0003038c..0002e44c]

Call frame traceback EIPs:
  0x00018604
  0x000186e6
  0x00017a6b
  0x000127db
  0x000127e9
  0x00013003
  0x0001318a
  0x000015d7
  0x00015a82

// ############# Compilation : END ############


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


- Raw text -


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