Boost logo

Boost :

From: Alexander Nasonov (alnsn-boost_at_[hidden])
Date: 2005-06-25 04:28:09

John Maddock writes:

> Sorry, but why do you need it for that? the only choices for int_fast_t
> are:
> int
> or
> some type wider than int that happens to be "faster" on the platform in
> question.

May be you right. An example of converting slow char to fast int attracted
my attention and I posted a reference.
Enums are out of scope of int_fast_t but even if they were, they are usually
as fast as int (except for special cases like -fshort-enums flag on g++).

> Still trying to understand what this ones for... John.

Well, if it's not performance then it's a size of application ;)
If some function template treats enumerations as numeric then converting all
enums to promoted types reduces number of instantiated functions. Typical
example is integer to string conversion.

BTW, why promotions exist in C/C++?

Alexander Nasonov

Boost list run by bdawes at, gregod at, cpdaniel at, john at