Deprecate implicit conversion between signed and unsigned integers

DLearner bmqazwsx123 at gmail.com
Fri Feb 7 21:04:56 UTC 2025


On Thursday, 6 February 2025 at 20:44:46 UTC, Walter Bright wrote:
> Having a function that searches an array for a value and 
> returns the index of the array if found, and -1 if not found, 
> is not a good practice.
>
> An index being returned should be size_t, and the not-found 
> value should be size_t.max.
>
[...]

Or, maintaining size_t, make first index of an array 1 not 0, and 
return 0 if not found.
Like malloc.

First array index is 1 also eliminates a fruitful source of 
off-by-one errors.




More information about the dip.ideas mailing list