Article View: comp.std.c++
Article #2092Re: STL Traps and Pitfalls wanted
From: John Max Skaller
Date: Tue, 03 Oct 1995 02:27
Date: Tue, 03 Oct 1995 02:27
33 lines
1804 bytes
1804 bytes
horstman@jupiter.SJSU.EDU (Cay Horstmann) wrote:
>Do you know of other
[apart from using the wrong iterator]
>STL traps and pitfalls that you'd like to be caught
>at runtime, rather than having a segmentation fault deep in the bowels of
>the template code? Thanks!
0) [Supplying an iterator not reachble from another-already noted]
1) Incrementing an iterator which is not incrementable.
2) Dereferencing an iterator which is not dereferenceable.
3) Violating a "no overlapping range" constraint (e.g. in "copy()")
4) using an invalidated iterator
More subtle violations:
6) providing an invalid comparison -- this one probably CAN'T be
checked at run time. But it can cause, for example, "sort()"
to go into an infinite loop, or mis-sort things.
7) supplying an iterator of the wrong category [eg an input iterator
where a forward iterator is required]
--
John Max Skaller voice: 61-2-566-2189
81 Glebe Point Rd fax: 61-2-660-0850
GLEBE NSW 2037 email: maxtal@suphys.physics.oz.au
AUSTRALIA email: skaller@maxtal.com.au
---
[ comp.std.c++ is moderated. Submission address: std-c++@ncar.ucar.edu.
Contact address: std-c++-request@ncar.ucar.edu. The moderation policy
is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
Technical Details
Message-ID:
<44p4hb$r4t@metro.ucc.su.OZ.AU>Path:
arc1-ca.pugleaf.net!in2.uu.net!bounce-backReferences:
<44hb2s$4bi@jupiter.SJSU.EDU>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!in2.uu.net!bounce-back Date: 03 Oct 95 02:27:12 GMT Approved: fjh@cs.mu.oz.au From: John Max Skaller <maxtal@suphys.physics.su.oz.au> Newsgroups: comp.std.c++ Subject: Re: STL Traps and Pitfalls wanted X-Original-Date: 2 Oct 1995 16:38:03 GMT Organization: MAXTAL Message-ID: <44p4hb$r4t@metro.ucc.su.OZ.AU> References: <44hb2s$4bi@jupiter.SJSU.EDU> X-Mailer: Mozilla 1.2N (Windows; I; 16bit)