Worst ideas/features in programming languages?

Kagamin spam at here.lot
Tue Oct 12 08:23:59 UTC 2021

Usage of unsigned integers as positive numbers.
cf. dotnet uses signed integers and the sky doesn't fall (it's 
32-bit int most of the time even). Granted some C and posix 
functions use signed integers when they need to return -1 
sentinel value. Recently I ported an oldish program to 64 bits, 
naturally it used narrowing conversions everywhere, but it was 
mostly signed integers, those aren't very sensitive to narrowing 
and extension. But the program crashed; when I looked at the 
cause, it was STL's string::find method returning unsigned 
integer even though it returns a sentinel value string::npos when 
the searched string isn't found, and the program there converted 
the returned value to uint, but then 
string::npos!=cast(uint)string::npos - unsigned integers are 
sensitive to extensions.

More information about the Digitalmars-d mailing list