3 ms·
They are separate languages, but it is definitely not like saying ML/Haskell. Most C code can be converted in C++ without too much work. In fact, that is what G
by danieldk 11y ago
They are separate languages, but it is definitely not like saying ML/Haskell. Most C code can be converted in C++ without too much work. In fact, that is what GCC did:
https://lwn.net/Articles/542457/ https://lwn.net/Articles/542457/
You cannot easily do that with a multi-million SLOC ML project.
- golergka 11y ago> Most C code can be converted in C++ That is bad, and is ripe to create a lot of errors. C programmer who tries to write C code in C++ has the worst problem ever, IMO: he doesn't know that he's wrong. Everything compiles, everything works, and he goes home happy after a productive day of laying mines for future maintainers.
- GFK_of_xmaspast 11y agoFor example?
- yoklov 11y agoThis is an opinion that I see a lot and it's very overstated IMO. If you write good C code, I'm perfectly happy to see it in C++. In fact, you could almost say it's a relief, largely because it tends to be impossible to write any overly-clever template-inspired madness that will be hard to understand and drag down compile times for a small benefit. Additionally, when it comes time to optimize code (assuming this block is worth optimizing, and already is using the optimal algorithm), the C code tends to be closer to what you want to optimize than the C++ code. With the C++ code, you typically have to spend more time removing abstractions before you can start actually tuning it. That said, while bad code in either is bad (obviously), someone could probably make the argument that bad C++ code is easier to fix than bad C code. I might be able to be convinced of this.