Le 09/08/2024 à 00:10, karl@??? a écrit :
> Hendrik Boom:
>> On Thu, Aug 08, 2024 at 09:35:50AM -0500, o1bigtenor via Dng wrote:
> ...
>>> Why is C/C++ so absolutely wonderful?
> C is a really nice language compared to assembler.
> Though at the time, the assembler of e.g. MC68000 was
> a little high level lang. inspired with mult. adressing
> modes.
>
> As with assembler, you can make the program work with very
> low memory usage, useful for small microcontrollers.
>
> In C, you program close to the hardware, unless you happen
> to have an "interfering" operating system. On the other
> hand, the OS is probably written in C since it has to be
> close to the HW. Though, C doesn't work well with processors
> that don't have 8 bit bytes.
>
> C is a standard, there is lots of litterture about it as well
> official ISO standard documents describing it.
>
> In C the motto is: trust the programmer, the backside of that
> is the programmer needs to be aware of many strange things,
> mostly related to "undefined" behaviour and nitty-gritty details.
> It is somewhat easy to make hard to find mistakes.
>
> C syntax has inspired other languages, so even if you don't want
> to use C, you can learn a little C to make it easier to learn
> other languages.
>
> C is one of the few remaining compiled languages that remain,
> most other ones are interpreted or have a "runtime" abstraction,
> e.g. pascals p-code.
>
> And as grand prize:
> C has inspired a semi annual competition to make the most
> unreadable code in style:
> https://en.wikipedia.org/wiki/International_Obfuscated_C_Code_Contest
>
> ///
>
> I don't know much about C++ good points, except it allows you
> do things more generally, more object oriented. It so to say,
> allows you to write "cleaner" code in a more mystified way.
>
> A bad thing with C++ is that the object files are linker dependant
> so if you update or change the system linker, you might need to
> recompile everything. The way around that is to build your program
> static with as few external references as possible. That is why
> boost is distributed as a set of header files with no "source" files.
>
> ...
>> It was a breath of fresh air in the 1970's, but by now language
>> technology has advanced a lot since then.
> ...
>
> Ack, I loved it then (80's), still do.
Fully agree about C. In addition, a POSIX or near-POSIX programming
environment requires a C runtime library. This library takes in charge,
not only a common API for programmers, but also grants the proper
operation of the various system-calls, such as memory management, thread
synchronization and many other things. The development of such libraries
is such a huge and difficult work that nobody wants to redo it for every
language; therefore all build on top of it and, therefore, have
intrerfaces to the C language. There aren't many of these libraries,
around half a dozen, including those of Android, IOS, and BSD which
aren't used on Linux.
The problem of C is that it is much more subtle than it looks, and
it contains a lot of pitfalls. There is a new, more secure language,
which has the distinctive feature of having been accepted into the Linux
kernel: Rust, but it is not yet stable.
-- Didier