Fixing C's Biggest Mistake

Walter Bright newshound2 at digitalmars.com
Mon Dec 26 04:31:38 UTC 2022


On 12/25/2022 5:19 PM, Richard (Rikki) Andrew Cattermole wrote:
> C pre/post putting parameters into function parameter list is a pretty different 
> feel and I believe it had some semantic flow on effects from what I saw in a 
> 1970's era C compiler which was dead simple.

You're referring to function prototyping, a C++ feature which was backported to C.

I programmed in C a lot before function prototyping. The errors were rampant and 
very difficult to find. C compilers first started adding prototying as an 
extension, and it grew so popular it had to be put in the Standard.

C has had a number of fundamental improvements from K+R C that dramatically 
reduced the incidence of bugs. Function prototyping was probably the biggest.

Another big problem was sign preserving vs value preserving integer promotion. 
That made C unportable, and the community was evenly split between the two. Sign 
preserving won basically by fiat, and everyone else had to change their code.


More information about the Digitalmars-d mailing list