On 11/20/14, 5:02 AM, Walter Bright wrote:
On 11/19/2014 5:03 PM, H. S. Teoh via Digitalmars-d wrote:
If this kind of unsafe mixing wasn't allowed, or required explict casts
(to signify "yes I know what I'm doing and I'm prepared to face the
consequences"), I suspect that bearophile would be much happier about
this issue. ;-)

Explicit casts are worse than the problem - they can easily cause bugs.

As for me personally, I like having a complete set of signed and
unsigned integral types at my disposal. It's like having a full set of
wrenches that are open end on one end and boxed on the other :-) Most of
the time either end will work, but sometimes only one will.

Now, if D were a non-systems language like Basic, Go or Java, unsigned
types could be reasonably dispensed with. But D is a systems programming
language, and it ought to have available types that match what the
hardware supports.


Nobody is saying to remove unsigned types from the language. They have their uses. It's just that using them for an array's length leads to subtle bugs. That's all.

Reply via email to