3 ms·
Because usually ints are used as array indices, and you want them to be the same size as a pointer in that case. There is an issue to remove the notion of a "d
by pcwalton 12y ago
Because usually ints are used as array indices, and you want them to be the same size as a pointer in that case.
There is an issue to remove the notion of a "default" integer type.
- modeless 12y agoAh, I see. Personally I think that isn't a strong enough justification, since this choice introduces possible 32/64 bit portability issues and prevents optimizations in scenarios like this. Arrays with >4 billion elements are rare and it would be a shame to compromise the language design for them.
- dbaupp 12y agoIt would also be a shame to end up with an overly restrictively language in future, where large arrays/values need special `..._64` functions (taking 64 bit integers, rather than 32 bit ones).
- kazagistar 12y agoI like that justification, assuming there are int8, int16, int 32, int64, etc, there is no need for another int anyways.