3 ms·
> perfectly modern Its getting modern, but its no where near perfectly. There are three different ways to allocate heap data and at least one dates back to the
by zanny 8y ago
> perfectly modern
Its getting modern, but its no where near perfectly. There are three different ways to allocate heap data and at least one dates back to the 70s. There are at least five ways to initialize a variable last I checked. The language is ludicrously complex to parse for both a human and a computer because its been iterated on for so long.
Because the design space C++ occupies is so complex and lacking almost any feature of it kills competition Rust is about the only real competitor in the space of "modern language that does absolutely everything" besides peers like OCaml that often have too arcane a syntax for the C family linguists to get in to. But compared to C++, Rust is way more cohesive just because it started one decade ago rather than four and has much less baggage so far. And with its editions system will likely never have permanent unmitigated baggage to its benefit.
- shaklee3 8y agoYou cannot count malloc as a way to allocate heap memory as a downside. It's for legacy reasons, and can't change due to the c interoperability. In the recent Go best practices story, the author said there are at least 6 ways to declare a variable in Go. That's a language with no backwards compatible of any other language.
- zanny 8y agoYes you absolutely can, because the second you are writing C++ code with anyone but yourself you will eventually find, and have to rewrite, something someone wrote using malloc in C++. I've found code where developers casted perfectly useful data structures to void* for no reason to then index into it by memory offset to access its fields, I've seen well architected concurrent classes destroyed by consumers "friending" it and then directly addressing internal private data meant to be guarded via accessor functions, and more. C++ gives you infinite ways to shoot yourself in the foot, and even if you are the savant genius god programmer who manages to navigate its neck deep swamp of complexity your coworkers or even worse random strangers you collaborate with on the Internet absolutely won't.