Re: Deriving from templates

From: Victor Bazarov (v.Abazarov_at_comAcast.net)
Date: 01/12/05


Date: Tue, 11 Jan 2005 21:11:15 -0500


"Julie" <jj@networld.com> wrote...
> Victor Bazarov wrote:
>> Julie wrote:
>>
>>> [...]
>>> I'd hardly call the STL portions a model of how to do things. No
>>> offense to PJP, et al., but I consider the STL a _horrible_ mess of
>>> virtually unreadable code.
>>
>>
>> I am fairly certain it's perfectly readable to those who wrote it.
>
> Probably. And for the rest of us?

The Standard headers [even if they exist in a text file form] are not
intended to be read by us[ers]. All we need to know about them is
perfectly readably expressed in the Standard.

>> It is possible that they use an automated obfuscator before shipping
>> the final result, of course.
>
> Yes, possible, but if the case, of very detrimental value.

Why? The reason to "obfuscate" it is to protect from possible name
conflicts. Many variables there have the form _X (where 'X' is any
capital letter). Anything that is intended for access (like typedefs
and class/function names) is perfectly readable. Multiple statements
on a single source line is a necessity to keep the processing speed
to a maximum and space to a minimum.

> Forget the code, of all the STL documentation that I've seen, it is based
> on that (deliberately or consequentially) obfuscated code. Personally, I
> rate STL documentation as the worst there is, but I digress...

I suppose the documentation you write is perfect, yes?

>> Besides, Mike didn't suggest to use Dinkumware's version _specifically_
>> but "an STL implementation that you like". If you don't like any [you
>> have seen], it doesn't mean they all are bad.
>
> I'll readily admit that I'm far from an STL expert and have limited
> exposure to : Borland's version (from the early days), whatever has
> shipped w/ MS VisualC++ (Dinkumware included), and SGI. None of those
> qualify as readable to me.

Again, they are not intended to be readable [by you].

Get a copy of STLport, you actually may change your mind. And take a look
at other implementations, like GNU's.

> If you have any recommendations to _any_ implementation that is written w/
> /clarity/ in mind, please let me know, same applies to documentation.

No, I don't know of any, really. The Dinkumware source is fine with me,
especially since it works if I need to step through it (though very
rarily indeed).

> If anyone cares, and I doubt that anyone does, those are the *main*
> reasons that I don't spend a lot of time w/ STL. I didn't grow up on
> Unix, and personally, shun that style and level of obfuscation.

I don't think the two have anything to do with each other.

V



Relevant Pages

  • Re: Kann hier auch zum Thema c++ gefragt werden ?
    ... Gemeint war die STL = Standard Lib, sorry, Info: ... one can now push and pop integers onto this stack. ... In Java hat ist man übrigens von einigen zentralen Klassen, ...
    (de.comp.lang.c)
  • Re: Visual Studio STL on Linux? Portable STL suggestion?
    ... STL freely available with a commercial licence for e.g. Linux? ... the C++ standard (in fact it was in large parts incorporated into the ... MFC so you couldn't legally compile it using WINE under a free OS. ... STLport is a free project that also aims to provide a portable standard ...
    (microsoft.public.vc.stl)
  • Re: Any F2003 help translating C++ map syntax?
    ... >>part of the standard language, but makes a mockery of comparing ... > I sometimes miss convenient containers in the standard Fortran. ... That means that the standard STL might not be as ... > a hash table, if I remember correctly. ...
    (comp.lang.fortran)
  • Re: Any F2003 help translating C++ map syntax?
    ... > part of the standard language, but makes a mockery of comparing ... it's good to have things in the official standard ... For the map(*) in the STL, ...
    (comp.lang.fortran)
  • Re: How do I delete lines from a file using "ofstream" ?
    ... Paul LAURENT wrote: ... There is no STL, ofstream, or class in standard C. ... C++ Faq: http://www.parashift.com/c++-faq-lite ...
    (comp.lang.c)