Why is it that no one writes with portability in mind in druntime?

Johannes Pfau nospam at example.com
Mon Nov 25 10:07:40 PST 2013


Am Mon, 25 Nov 2013 09:46:14 -0800
schrieb Andrei Alexandrescu <SeeWebsiteForEmail at erdani.org>:

> On 11/24/13 11:43 PM, Iain Buclaw wrote:
> > Library maintainers need to stop writing code with the assumption
> > that their code is only going to be used with dmd and x86, and they
> > should have stopped doing it 6 months ago.
> 
> I agree, but the real solution to that would be unittests that fail.
> 
> Andrei
> 
> 

Or static asserts. It looks like some people just don't know that the D
real type is platform specific. A simple

static if (real.mant_dig == 64)
else static assert(false);

Already helps a lot. If the code instead just assumes x86 real
layout we usually only see memory corruption or bogus / invalid
results and debugging that is not much fun.


More information about the Digitalmars-d mailing list