Fixing C's Biggest Mistake

Walter Bright newshound2 at digitalmars.com
Thu Dec 29 20:38:23 UTC 2022


On 12/28/2022 1:33 AM, Timon Gehr wrote:
> On 12/27/22 23:53, Walter Bright wrote:
>> This is not a failure, it's a positive feature.
> 
> To some extent. Aspects of this have been lovingly nicknamed the "billion dollar 
> mistake".

I don't agree with that assessment at all. Having a seg fault when your program 
enters an unanticipated, invalid state is a *good* thing. The *actual* billion 
dollar mistake(s) in C are:

1. uninitialized data leading to undefined behavior

2. no way to do array buffer overflow detection

because those lead to malware and other silent disasters.

And it's good to have a state that a memory object can be initialized too that 
cannot fail.



More information about the Digitalmars-d mailing list