Boost logo

Boost :

From: Reid Sweatman (reids_at_[hidden])
Date: 1999-08-18 14:28:54


> There are no MIN/MAX in the standard, but there are two template
> function min and max from <algorithm>.

True, but in just about every project I've worked on, someone, and sometimes
more than one person ended up putting those hoary old macros in headers
somewhere. Besides, if you work in Windows, you've got them whether you
want them or not.

> The object is correct code. Altering standard names is just wrong.

Couldn't agree more. I have no idea why the people writing the early core
code for my current project saw fit to create typedef'ed MIN/MAX template
functions for just about every type in the program, including
language-defined types. Especially since they got carried away with
operator overloading, didn't recognize that having a bunch of member
functions that took "pair" as their only argument constituted illegal
overloading no matter what was in the pair, and ended up using #if 0 to
disable the most important parts of the code. What good is a complex object
if you can't even have an assignment operator, or a XXTOR? The code bloat
that lead to is unbelievable, since we're talking some really fundamental
classes here, and no one before me spotted the problem in the five years
since the code was written. I'd patch it up, but time's critical right now,
and I don't dare take a chance on breaking other working code. But where
possible (not often, since encapsulation is almost non-existent in this
program), I've defined my own equivalent classes, and used the pre-existing
ones only when I have to interface with code external to my modules. But
talk about a pain in the booty.

Hell, the MIN/MAX functions, which are enabled, can break because of the
lack of proper canonical operators (these classes *really* require the big
three), if you put an expression that causes a class copy or assignment into
the MIN or MAX braces. Talk about side-effects! <g> Funny thing is, the
programmer largely responsible for that code now says he has no use for
templates because they just don't work. Go figure. Gee, and to think, this
e-mail will be permanently archived in the company's server backups. Ah
well, back to actually working instead of ranting.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk