STL debug mode

Peter Nordlund L (ERA) Peter.L.Nordlund@era.ericsson.se
Fri Apr 19 01:31:00 GMT 2002


> -----Original Message-----
> From: Phil Edwards [mailto:phil@jaj.com]
> Sent: Friday, April 19, 2002 9:47 AM
> To: Peter Nordlund L (ERA)
> Cc: 'libstdc++@gcc.gnu.org'
> Subject: Re: RE: STL debug mode
> 
> 
> On Fri, Apr 19, 2002 at 09:16:27AM +0200, Peter Nordlund L 
> (ERA) wrote:
> > > We prefer to do as many checks as we can during compilation; 
> > > that way we can
> > > have them on all the time without penalizing your generated 
> > > program speed.
> > 
> > Yes of course, but compile time checks will not catch
> > out of range errors etc, that are created during runtime.
> 
> Those are required to throw std::out_of_range exceptions, or 
> other exception
> types as required by the standard.  We have to catch those 
> kinds of mistakes
> regardless of "debug" mode or any other kind of build.
> 

Sorry, but I don't understand what you mean.
I'll take a concrete example of faulty code that STLPort in debug mode 
will detect and give useful diagnostics on.
I would also like to get such diagnostics when using gcc without STLPort.
In my experience the following program will cause a Segmentation fault.:

#include <vector>
#include <iostream>

int main(){
  std::vector<int> v;
  std::cerr << v[2];
  return 0;
}



More information about the Libstdc++ mailing list