This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
RE: RE: STL debug mode
- From: "Peter Nordlund L (ERA)" <Peter dot L dot Nordlund at era dot ericsson dot se>
- To: "'Phil Edwards'" <phil at jaj dot com>
- Cc: "'libstdc++ at gcc dot gnu dot org'" <libstdc++ at gcc dot gnu dot org>
- Date: Fri, 19 Apr 2002 10:29:59 +0200
- Subject: RE: RE: STL debug mode
> -----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;
}