Open Bug 556701 Opened 10 years ago Updated 10 years ago

STL: Review exception safety of <vector> on gcc and MSVC

Categories

(Core :: XPCOM, enhancement)

enhancement
Not set

Tracking

()

People

(Reporter: cjones, Unassigned)

References

(Blocks 1 open bug)

Details

No description provided.
Blocks: 564608
/usr/include/c++/4.2.1/stl_vector.h:767 has a try/catch block.  Is that safe?
Yes.  The block is attempting to catch std::bad_alloc, but (i) try/catch are ignored in -fno-exceptions; (ii) Gecko overrides ::operator new() (which std::allocator uses) with an implementation that never throws bad_alloc.
Then I can confirm that <vector> is safe for gcc 4.2.1 (on mac, but I don't expect the header to be different on linux).

Do we need to look at other gcc versions as well?
I can also confirm the safety of the <vector> header on MSVC 2008.
<vector> changed a fair amount in 4.4.  Not sure about 4.5.
I also checked the gcc libstd++ trunk source, and it looks good to me.  This <http://gcc.gnu.org/viewcvs/trunk/libstdc%2B%2B-v3/libsupc%2B%2B/exception_defines.h?view=markup> makes me much happier as well.  :-)
You need to log in before you can comment on or make changes to this bug.