logoalt Hacker News

andyferristoday at 11:24 AM2 repliesview on HN

Low-level programming gets a bad name because C has many footguns and the spec leaves much behavior undefined - a fact that implementers use almost adversarially (which I'd support, if the goal was to refine the spec...).

C++ adds more high-level conveniences without actually removing the footguns and undefined behavior (much C code compiles in a C++ compiler).

Zig tries to keep the low-level C philosophy but have things more well factored and well defined. The result is you _can_ tinker in high-level code, yet "drop down" into low-level code as you desire.

(Compared to rust, you get fewer compiler-enforced guarantees, but unlike C the language isn't trying to make high-level code adversarial).


Replies

jcultoday at 12:22 PM

It made me laugh to think of C implementers being adversarial! It can feel that way.

I haven't really used modern C, not sure if it's evolved as much as modern C++, which I feel is a joy to use, and a lot safer. But then I've been writing C++ for decades.

I feel like C evolved from basically syntax sugar for assembly, so that's where all the footguns come from, rather than being actually adversarial.

show 2 replies
pjmlptoday at 11:40 AM

Basically what the world has lost by ignoring Modula-2 and Object Pascal, and going down the C path.

show 1 reply