Boost logo

Boost :

From: Scott Schurr (scott_schurr_at_[hidden])
Date: 2005-10-19 20:01:45


Reece Dunn wrote:
> Have you tried an approach that does not use enums. You can
> either use a maximum-size integer:

Let me give you a little background. One of my goals for
this template is for it to take no space. I've been writing
C++ code for embedded systems. It's important to me that the
conversion from binary to hex (or whatever) happen entirely at
compile time, leaving no trace in the object file.

The advantage of enums is that they are guaranteed to occupy
no space. If I start using integers, even static const integers,
the compiler has the choice of leaving some number of those
in the object code. I'm trying to avoid that.

At any rate, that's my justification for using enums instead
of the largest integer for my calculations. I hope now I'll learn
why integers are okay, since there are template metaprogramming
experts listening.

Thanks for the hints and advice.

Scott Schurr


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