Secure Coding mailing list archives

Re: MISRA C (was: Industry support groups that foster secure/quality coding practices)


From: Brett Hutley <brett () hutley net>
Date: Tue, 13 Jan 2004 15:18:23 +0000


Steve Litt wrote:

Where would I find the Standard Template Library for the gcc that 
comes on Linux computers (I use Mandrake 9.0 and 9.2)?


If you've built/installed the gnu c++ compiler, you should already have
an implementation of the STL.

GNU's implementation has some differences from other STL implementations
that I've used. In the GNU implementation you don't seem to get an
iterator return from a collection erase(), which makes life a little
inconvenient. You can't seem to do:

iter = mymap.erase(iter); // iter advances to the next position

which I thought was part of the standard (must investigate).

The STL is one of the things that make programming in C++ so enjoyable.
In Java, the collections hold Objects so when you grab something out of
the collection, you've got a java.lang.Object in all it's glory. You
have to cast the object to the correct type in order to get some tasty
derived-type goodness out of it. Using the STL, because the collections
are typed at *compile* time, collections hold pointers to objects of the
specified type, so you can access the desired interface without
compromising yourself with those nasty casts. (Disclaimer: I like both
C++ and Java, but this is one of the things which I *really* like about
the C++/STL dynamic duo).

I thoroughly recommend Scott Meyers' books BTW - Effective C++, More
Effective C++ and Effective STL. If you haven't read these books, you
just haven't lived.

--
Brett Hutley [MAppFin,CISSP,SANS GCIH]
mailto:[EMAIL PROTECTED]
http://hutley.net/brett









Current thread: