[geeks] C++ style
Jonathan C. Patschke
jp at celestrion.net
Thu Sep 19 18:23:27 CDT 2002
On Thu, 19 Sep 2002, Joshua D Boyd wrote:
> Err, do they come by default with VC++ 6.0 and gcc?
I thought STL was a component of the ANSI C++ runtime library standard.
It's well-enough documented in Stroustrup's book for me to think that
it's expected to be part of a C++ implementation.
> Might I point out that my education at school did not cover things like
> STL, or "how the bloody thing works", or even "here are the titles of
> the relevent books that you can find in our library".
That's really odd. C++ is everywhere (much to my chagrin), and the STL
makes the language a much more useful beast.
> I have rather limited disk space on the local machines at school.
Oh, eduquota. Nevermind. BTDT.
> What I've been doing so far is having a common implementation of linked
> list (I don't use doubly linked much) and vector handy, and embedding it
> straight into the program rather than have a library depency.
Yeah, that's about what I've been doing in C. I don't bother with
vectors, though; dynamic arrays in C as so common as to be idiomatic.
> Well, the point somewhat is that I want several types on the stack, in
> the dict, or whatever, and I want to be able to query them when they
> come off to find what they are. Of course, for that, a base object
> would be far more appropriate.
Very, very true. Or, if that doesn't make sense, you can always use a
proxy-container object that can only hold specific types of objects, and
then construct your container so that it can only hold objects wrapped
in a proxy-container. I can't think of what this design pattern is
called, but it's in the book[1]. :)
> I'm not using the current versions of compilers. At school I'm using
> VC++6, and GCC 2.95.4 and there is nothing I can do to get these
> updated. We have VC++.NET, but are being told not to use it for
> assignments. I think I have GCC 3.1 at home, but that doesn't help me
> when I need the code to work on all.
I -know- VC++ 6 has the STL. There was great fanfare when it was
included in v4.x. GCC 2.95.x has it if libstdc is installed, since the
STL was unbundled from the gcc source back then.
> I'll have to keep and eye open for that book. I don't currently have
> the money to just order it off Amazon.
Half-Price Books almost always has it in stock. Also, check on eBay at
the ends and beginnings of semesters.
[1] _Design_Patterns_ by Gamma, Heim, Johnson, and Vlissides. If you
don't have this book, borrow it from a library. This book will keep
you from shooting yourself during the transition from imperative or
functional code to OO code. If you can't get it easily, and don't
have it, let me know.
--
Jonathan Patschke
> Can you SysAdmins tell me what might go on in a typical day?
Hours of endless frustration punctuated by moments of sheer terror.
--Saul Tannenbaum (in the Monastery)
More information about the geeks
mailing list