logoalt Hacker News

nine_ktoday at 5:50 AM1 replyview on HN

C++ is like PHP: it used to be a terrible language, and you can still reach for everything terrible if you wish. But during last maybe 10 years, C++ made a lot of effort to become a language with fewer footguns and more safe, high-level tools.

Still I won't start a new project in C++. If I wanted high-level features and zero-cost abstractions, I'd take Rust. If I wanted working really close to hardware, do bit-twiddling and knowing where every byte is allocated, I'd take Zig. If I wanted to write a small piece of code intended to run absolutely everywhere, including old and esoteric architectures, I would still have to go with C (plain, old).


Replies

Panzerschrektoday at 6:41 AM

> If I wanted working really close to hardware, do bit-twiddling and knowing where every byte is allocated, I'd take Zig

Why not C++? It allows as many low-level operations as one wishes, but don't forces you to manage memory manually where it isn't necessary.

> If I wanted to write a small piece of code intended to run absolutely everywhere

GCC and Clang have support of C++ since many years. Is there any modern platform for which no GCC or Clang backend exist?