Fixing C's Biggest Mistake

claptrap clap at trap.com
Tue Jan 3 11:29:32 UTC 2023


On Tuesday, 3 January 2023 at 08:49:55 UTC, Walter Bright wrote:
> On 1/2/2023 1:50 PM, claptrap wrote:
>> That's a logically flawed argument because it rests on the 
>> assumption that the only possible way to handle a null when 
>> converting from a nullable to a non-nullable is to abort the 
>> program.
>
> I never said "only possible way". However, it is the usual 
> case. Now, if the *user* checks a pointer for null, and it 
> isn't, then it won't seg fault from subsequent use.

It's implicit in your position. If you want to say "they are the 
same" then you have to also hold that they must always abort on 
null. "Usually" isnt enough

A usually aborts on NULL
B always aborts on NULL
Therefore they are the same...

***doesn't work***.


>> It's also a strawman because it also misses the point that its 
>> not about what you do with the null, but knowing where they 
>> might get in. Statically knowing where the external doors are.
>
> Indeed, that is a difference. I've rarely had any actual 
> trouble tracking it back to its source, though.

It'd be like you could verify 90% of your numeric code wont 
generate NaNs at compile time, and so you'd only have to check 
the boundry between the 10% that can and the 90% that cant.

It'd be more useful than default to NaN is with floats. And you 
like that?




More information about the Digitalmars-d mailing list