On Thursday, 5 December 2013 at 19:51:52 UTC, Ary Borenszweig
wrote:
On 12/5/13 4:35 PM, H. S. Teoh wrote:
On Thu, Dec 05, 2013 at 03:47:27PM -0300, Ary Borenszweig
wrote:
[...]
Cough, cough, make array length be an int.
Do you really need arrays that big? :-S
(I'm talking to Mr. D Compiler here)
A negative length array makes no sense.
Of course not. And it will never be negative. But make it
signed and all the problems everyone is having several times
every month will be gone forever.
I defended once the approach took by FreePascal: they declared a
signed integer that covered the larges available range on a
machine (now it occurred to me that the compiler could even cover
*twice* that range with a simple trick) and then, all other
integer types, signed or unsigned/positive were sub-ranges of the
first. Comparisons were made at this largest level.
I dunno how complicated and how much overhead for this.