Topic: STL header naming [STL.H - where is it?]
Author: khan@xraylith.wisc.edu (Mumit Khan)
Date: 1995/05/11 Raw View
In article <3o68c0$5oq@offas_dike.sbil.co.uk>,
Marc Shepherd <shepherd@debussy.sbi.com> wrote:
>
[...]
>Incidentally, ObjectSpace's idea of having just one header file for all
>of STL is positively looney. Why include all that muck in every module,
>when you're probably using only a small percentage of it? The ANSI committee
>evidently agrees, since it maintains the approach of multiple headers,
>rather than just one.
>---
>Marc Shepherd
>Salomon Brothers Inc
>mshepherd@mhfl.sbi.com The opinions I express are no one's but mine!
>
Marc,
Yes, using the individual header files does indeed save on compile/link
cycle time, but there is one *big* disadvantage: there is *NO* standard
yet as to *WHAT* file(s) to include for what. For example, to use the
``for_each'' algorithm, you'd have to include <algorith.h> if using
ObjectSpace, and <algo.h> if using GNU/FSF libstd++. I believe ANSI
is looking into it as we write, and according to Mike Stump, there have
been moves to using something like <all> to get ALL of ANSI stuff in
your code (STL and all). Hopefully with machines and compilers getting
faster, this will be less of a bottleneck in the future, but right now
I personally do include individual files to save time (the price I pay
are the inelegant #ifdefs to switch on variuos STL implementations).
As an aside, I typically recommend using <stl.h> (it's quite trivial to
create one for implementations that don't have one, such as FSF/GNU)
to STL newcomers around here until they become more accustomed to using
STL; once people figure out STL interface, they usually snoop around and
figure out the implmentation details, and it's much easier after the first
learning hurdle.
Also, I would think STL/ANSI C++ header files would make a very good case
for pre-compiled header if your compiler supports it. None of mine does.
(Does pre-compiled header mechanism really save time in medium to large
projects?)
mumit
%--------------------------------------------------------------------%
Mumit Khan khan@xraylith.wisc.edu
Researcher http://www.xraylith.wisc.edu/~khan/
Center for X-ray Lithography Phone: 608-265-6075/877-2400
University of Wisconsin-Madison FAX: 608-265-3811/877-2401
%--------------------------------------------------------------------%