Newsgroups: comp.lang.c++,comp.lang.smalltalk,comp.object
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!news2.near.net!satisfied.elf.com!news.mathworks.com!uunet!in1.uu.net!allegra!alice!ark
From: ark@research.att.com (Andrew Koenig)
Subject: Re: C++ Productivity
Message-ID: <D3rCwL.D8o@research.att.com>
Organization: AT&T Bell Laboratories, Murray Hill NJ
References: <1995Feb4.210947.718@mole-end.matawan.nj.us> <1995Feb6.132028@di.epfl.ch> <3hdugu$l2q@calvin.st-and.ac.uk>
Date: Fri, 10 Feb 1995 00:19:33 GMT
Lines: 24
Xref: glinda.oz.cs.cmu.edu comp.lang.c++:111938 comp.lang.smalltalk:20640 comp.object:26463

In article <3hdugu$l2q@calvin.st-and.ac.uk> ajry@st-andrews.ac.uk (Alistair James Robert Young) writes:

> IMO, from a software user's point of view, C++ templates are a thing of
> nightmares. We already hear complaints every day about the ever-increasing
> size of .EXE files for applications; now along comes C++ with its convenient
> way of generating dozens of chunks of code identical in *everything* but the
> type that they handle! The reduction in code size I achieved by replacing
> a B-Tree template for eight types with a class for a B-tree of (void *)
> and derived classes to for each type was quite amazing.

Moreover, I'll bet you could have used templates to create those
derived classes, in which case there would have been no overhead
compared with doing it by hand.

Of course, the choice between expanding out the B-tree for each type
and making it work in terms of an underlying pointer-based data structure
is a classic time-space tradeoff.  Compilers are not generally in
a position to second-guess how their users want to make such tradeoffs,
which means that if you care about the outcome then you have some
responsibility to care about the choices you make.

-- 
				--Andrew Koenig
				  ark@research.att.com
