[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Lies in education [was Re: The "loop and a half"]

Rhodri James <rhodri at kynesim.co.uk>:

> C++ is designed, true, but well designed? It has a fundamental flaw;
> it wants to be both a high-level language and compatible with C, under
> the mistaken impression that C is a high level language. Since C is
> actually an excellent macro-assembler, this dooms the exercise from
> the very start.

C++ was never compatible with C, any more than Peter Jackson's Hobbit
movies were a rendition of JRR Tolkien's "Hobbit, or There and Back

Objective C, by contrast, was designed to be compatible with C. That's
why its syntax looks so weird.

> C++ lives in the no-man's land between programming languages that care
> quite a lot what processor they are running on and programming
> languages that wouldn't recognise hardware if it came up and bit them.

C is the traditional application programming language in the Unix
family. It doesn't see any hardware. It only sees function libraries and
virtual memory.

(Exception: recent memory barrier semantics in C force every C and C++
programmer to be acutely aware of multicore RAM cache behavior the
moment you start doing multithreading or multiprocessing. To me, this
looks more like a bug than a feature in the languages.)

> It can be used either way, but comes with all the baggage for both. I
> am yet to see a C++ program that wasn't more comprehensible when
> rendered as either C or Python (or the high-level language of your
> choice, I imagine).

I agree.

C++'s main problem is that it tries to solve the wrong problem. A C++
compiler seeks to make sure your program doesn't have bugs. That noble
(but futile) goal makes it painful to program in C++.

Python and C don't try to protect you. In return, you get syntactic
convenience that probably enhances the quality of your programs.