Today I learned that C is a truly hideous language

in til •  4 years ago  (edited)

Screenshot from 2020-07-23 09-14-11.png

The compilation model of one of the oldest still used programming languages has a flaw in it that is well known and hasn't been fixed even with over 40 years since its inception.

But it doesn't stop there. The above is from this stack exchange post is in relation to c++, not C.

C++ adds these wonderful things called 'templates'. They are a type of implementation of generics - a type of programming technique whereby you can swap out a variable if its intrinsics are the same, ie, a number, can be compared to another number and greater, equal or less than as the result.

These wonderful tools, which actually don't in reality really save any time at all, lean right on top of that bug with the compilation model flaw mentioned in the above quote, compound this problem by making huge huge trees of shit to cope with complex nested templates... yes, templates within templates.

The upshot of this absolutely primitive bullshit is that the code of the Steem node is plagued by several units of compilation that require over 6 gigabytes of memory to complete. If you run a build in parallel with these on, no matter if you have enough memory configured including swap, the compilation will fail because 3 other jobs will use up the whole swap. You can get a build to work by telling it to run one at a time on one core.

I am very hostile to C++ for very good reasons, and today I now have a really really good one I didn't know about, and a really really good reason why there should be no generics in the Go language, period.

Go's compiler is highly optimised by minimising the complexity of the language specification. It takes a lot of shortcuts that have a relatively low cognitive burden on the programmer, and its build system is native, there is no separation between the compiler and the essential dependencies management, and it does not require repeated specification. And on the subject of repetition, C/C++ programs generally require at least 2 specifications that have to stay synchronised. It's absolutely abominable.

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE BLURT!