Annoyance with new integer promotion deprecations

H. S. Teoh hsteoh at quickfur.ath.cx
Tue Feb 6 14:46:02 UTC 2018


On Tue, Feb 06, 2018 at 10:43:39AM +0000, Dominikus Dittes Scherkl via Digitalmars-d wrote:
[...]
> Every type should have a NAN value.  For the signed types the extra
> useless .min is a perfect candidate for a NAN.  That allows -x to
> always be of the same type as x, which I think is a good thing(tm).

All I can say to that, is to quote Knuth:

	People who are more than casually interested in computers should
	have at least some idea of what the underlying hardware is like.
	Otherwise the programs they write will be pretty weird. -- D.
	Knuth


> Fortunately, in D is't absolutely easy to define just that kind of
> types that fullfill all these requirements. Its about 100 LOC.  I call
> them sbyte, sword, sint and slong which are even better names than the
> original ones (because they directly indicate that they are signed and
> match the unsigned ones).  So I never again bother with the completely
> nuts builtin signed types.

Sure, D gives you the flexibility to do that. But if you need high
performance, it will be better to follow the hardware semantics more
closely. It's not D that has completely nuts signed types; it's your
hardware. :-P (Besides the completely nuts casting rules that has
nothing to do with the hardware, that is. That part is a stink we
inherited from C.)


T

-- 
Famous last words: I *think* this will work...


More information about the Digitalmars-d mailing list