Hello aJ,

"BCS" <[email protected]> wrote in message
news:[email protected]...

Hello aJ,

How can/does D guarantee that "int" will always be 32 bits on all
platforms? Does this mean that D won't work on some platforms?

D is not built for 8 or 16 bit systems. However 32 bit math can be
done on a 16 bit CPU, it's just slow. In the other direction, 32 bit
math (and 16 and 8 bit) can be done on a 64 bit CPU so that's not a
problem.

I wasn't thinking about math issues,

OK

but rather struct field
alignment/portability, and platform alignment requirements for basic
types, issues.

Unless you say otherwise, the compiler is free to align struct however it wants (this is true in C but there are conventions) and in general you can't expect it to do the same for different system (again, ditto re C)

OTOH I'm not sure how that links into int being the same size all over. If anything that should make these issue less of a problem.

I'm guessing that it is all worked out by the compiler,
so that makes the development of a compiler more difficult, if so, but
how much more difficult? A simple example or description of how this
is done would really be great. (BTW, this is definitely an area where
I would approve of more language implementation complexity for the
great strides in programming efficiency (and fun!) it gives).


Reply via email to