Boost logo

Boost :

From: David Abrahams (abrahams_at_[hidden])
Date: 2001-04-14 10:09:34


----- Original Message -----
From: "Peter Dimov" <pdimov_at_[hidden]>

> Yes, in theory. However RTTI, for instance, does cost quite a lot more
space
> (many console game programmers never enable it - and some even disable
> exceptions) and boost libraries don't exactly try to accommodate their
point
> of view.

I theory, at least, it should be possible to leave these RTTI enabled at no
cost, if it's unused. It also should be possible to pay for RTTI only for
the inheritance trees in which it is used... in theory ;-)

I don't think disabling exceptions is compatible with the goal of efficient
C++ programs where errors are recovered from, which I think is what you've
been talking about... at least not if you've got a compiler which generates
small exception tables (Metrowerks).

I think the lesson here is that which language features turn out to be
expensive is really implementation-dependent. It can be hard to anticipate
which checks end up being "free".

> Anyway, I think that the basic idea of having two separately-configurable
> precondition macros is sound.

Maybe for some people. My approach to programming is based on making
absolute distinctions wherever possible. So many design choices can be made
with so many degrees of freedom that I need ways to simplify my world. I
find ways to settle things so I don't have to keep thinking about them (I
think you can see this in my approach to exception-safety). Asking me to
decide whether each precondition check might compete for cycles with the
rest of my code, or whether it might be the straw that finally pushes my
inner loop out of the cache will make it harder for me to write code and
will be a disincentive to add the precondition check at all.

-Dave


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