Why is it that no one writes with portability in mind in druntime?
Jonathan M Davis
jmdavisProg at gmx.com
Sun Nov 24 14:32:54 PST 2013
On Sunday, November 24, 2013 18:47:49 Andrej Mitrovic wrote:
> On 11/24/13, Johannes Pfau <nospam at example.com> wrote:
> > We have one type in D which has a different size depending on platform
> > and it's the number one source for platform-specific problems...
>
> It seems any time a language defines something as
> implementation-specific or platform-specific it ends up giving
> everyone headaches. I don't know why D chose to use reals like that,
> after enforcing the sizes of long/int/etc. types.
I'd expect it's because D is a systems language and tries to give you full
access to the hardware when you need it, and high-precision floating point
types were considered useful enough that they shouldn't require inline
assembly to work.
However, in most cases, I think that what it means is that if you use reals
where you care at all about the bit layout, you're just not going to be able
to write platform-independent code (e.g. std.bitmanip punts or reals for
swapping endianness).
- Jonathan M Davis
More information about the Digitalmars-d
mailing list