This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Ada policy
Florian Weimer wrote:
<stdint.h> is a huge improvement.
Yes, absolutely!
If your code is portable, it can't
make a difference if you use int_least24_t or int_least32_t. In fact,
you could even substitute int32_t for int24_t, and the code would
still work as before.
Well .. you can make portable code by implementing a Turing machine and
doing everything at that level and "the code would still work as before",
but efficiency is not something you can afford to throw out of the window
when writing portable code.
Specifying int_least32_t on a 24 bit machine for quantities that could
fit fine in 24 bits is likely to be a severe efficiency hit. The whole
style in Ada is to specify types that accomodate the problem space and
then let the compiler choose efficient mappings.> By the way, your example
| So for example, there is no equivalent of
|
| type R is range -2**23 .. 2**23-1;
|
| which you expect to map into 24 bits on a 24 bit machine, and 36 bits on
| a 36 bit machine.
seems to lack an R'Base. Otherwise, your comment about mapping is a
bit misleading.
The omission of an explicit base type is very definitely intentional here.
You are asking the compiler "you choose an efficient base type for me".
Specifying a base type is generally not what you want, since you do not
want to force the compiler to make an inefficient choice.