:: Re: [DNG] Why C/C++ ?
Top Page
Delete this message
Reply to this message
Author: Didier Kryn
Date:  
To: dng
Subject: Re: [DNG] Why C/C++ ?
Le 11/08/2024 à 04:06, Steve Litt a écrit :
> I think it's a pretty darn good language. It makes sense, its syntax is
> pretty guessable (except for pointers to functions), and it's a small
> language that's easily learned.
>

    Yes, you think you learned it... but sometime you discover you
missed something. And there's a lot one can miss in C. There's a lot of
subtelties, like in automatic type promotion, for example, like the
difference between static and automatic variables, static constants and
automatic constants, embedded functions... And this horrible thing of
using the equal sign for assignment:

When you write

x = 1;

...

x = 2;

    Any one having a notion of mathematics will call you a liar. And it
forces you to use == to mean equality, which has been the source of
zillions of bugs, because, in C, an assignment is an expression.

    In any human language, people count things by giving number 1 to
the first and number n to the nth. In C the first has number 0 and the
nth has number n-1. Just for the sake of pointer arithmetics.

    The enumerations share one single namespace, which is the same as
the variable names.

    In C, INT_MAX+1 == -1   ( INT_MAX is defined in <limits.h>)

   My PoV on C is that it is just the layer above assembler, in
addition to be universal. And, for this it is pretty good. It is good
for little things, but great things, like, eg, the Linux kernel or the
GTK library are real achievements of expert programmers. Yet I'm still
programming in C because of this: every programmer roughly understands
it. But after 44 years of using this language, I still learned something
2 weks ago and something else yesterday -- it's not so often though (~:

--     Didier