bearophile can say "i told you so" (re uint->int implicit conv)
renoX
renozyx at gmail.com
Tue Apr 2 01:29:40 PDT 2013
On Tuesday, 2 April 2013 at 07:49:04 UTC, Don wrote:
[cut]
> IMHO, array.length is *the* place where unsigned does *not*
> work. size_t should be an integer. We're not supporting 16 bit
> systems, and the few cases where a size_t value can potentially
> exceed int.max could be disallowed.
>
> The problem with unsigned is that it gets used as "positive
> integer", which it is not. I think it was a big mistake that D
> turned C's "unsigned long" into "ulong", thereby making it
> look more attractive. Nobody should be using unsigned types
> unless they have a really good reason. Unfortunately, size_t
> forces you to use them.
You forgot something: an explanation why you feel that way..
I do consider unsigned int as "positive integer", why do you
think that isn't the case?
IMHO the issue with unsigned are
1) implicit conversion: a C mistake and an even worst mistake to
copy it from C knowing that this will lead to many errors!
2) lack of overflow checks by default.
More information about the Digitalmars-d
mailing list