3 ms·
Most of the problems that C++ added on top of C are caused by RAII though (e.g. a too rigid coupling of code and data). I think Zig made the right decision with
by flohofwoe 5y ago
Most of the problems that C++ added on top of C are caused by RAII though (e.g. a too rigid coupling of code and data). I think Zig made the right decision with the 'defer' keyword, even if it requires some change of perspective.
- deleted 5y ago[deleted]
- ncmncm 5y agoBy "problems" I guess you meant usefulness: "Most of the usefulness that C++ added on top of C is a product of RAII." Because usefulness is why C++ is used so much. And, "too rigid" meaning maximally flexible, likewise.
- flohofwoe 5y agoThat's what I mean with "change of perspective". POD structs are entirely fine if a library API is designed from the ground up for them. It only becomes a problem when trying to write C++ code in C (or Zig in this case).
- ncmncm 5y agoPOD structs are fine if your wants are limited. Most usually, they are more error-prone and hard to use, and often slower. Limiting yourself to PODs is, first and foremost, limiting yourself. There are reasons why, in the highest-paid programming jobs, you would be laughed from the room if you suggested coding something in C. Dull knives, cracked pots, and filthy ingredients make a bad stew.