View mode: basic / threaded / horizontal-split · Log in · Help
August 31, 2003
Re: Typesize
In article <biknth$em5$1@digitaldaemon.com>, Ilya Minkov says...
>
>> Ilya Minkov wrote:
>>> Wrong. They are defined to be *at least* specified size - and is maent 
>>> to (though not necessarily must) be of exactly that size on 32-bit 
>>> architectures.
>
>Russ Lewis wrote:
>> Where do you see this?  http://digitalmars.com/d/type.html seems to say 
>> that the types are exactly a given size, not "at least."
>
>http://www.digitalmars.com/d/portability.html
>the first bullet.
>
>-eye
>

Yikes! This again (like with C) render it impossible to use the core types for
fields in struct that needs to ALWAYS be of an exakt size. Best example is the
TCP and IP-header struct which needs the 32bits type (and other types) to be
exactly 32bits. Nothing less, nothing more.

There is a need to two sorts of types IMHO. The exact ones and the "atleast"
ones. The exact ones needs to be used in cases as above. The atleast ones needs
to be used to make the program fast. I don't think the compiler it self can
figure out when its okej to "be atleast" with only fixed types. Thus we need
both sorts.

/Joakim Axelsson
Next ›   Last »
1 2
Top | Discussion index | About this forum | D home