C vs. C++ vs. ...
Posted Jun 29, 2012 21:53 UTC (Fri) by daniel
In reply to: C vs. C++ vs. ...
Parent article: Why learn C? (O'Reilly Radar)
...on every project I've ever seen converted to C++. Six months later, the project compile time has gone from 30 seconds to half an hour, the number of lines of code in the project has gone up by an order of magnitude, and the codebase is almost functionally back to where it was when the project was converted from C.
Anecdotes are wonderful aren't they? Even better than statistics for proving pet points. Interestingly, one of my projects supports modules written in either C or C++. I just ran a compile speed bakeoff between some representative files with equivalent number of lines. Result: gcc compiles 2.4 times faster than g++. I would qualify that with "if you don't go crazy with templates". I believe you will find this result quite reproducible. It is a far cry from the factor of 60 you claim.
As for number of lines of code, in every case where I have converted a C program of any complexity to C++, the program has gotten smaller, sometimes by a significant amount like 50% in cases where I was beating my head against the wall hacking up object style inheritance in C.
As far as functionality goes, I think it took me roughly a day to convert a good sized C project of 20K LOC to "C in C++", at which point the functionality is obviously equivalent. Of course it did not stay as C-in-C++, it actually began to accrete new functionality at a rate that was hitherto impossible in its C form.
I would submit that where your experience is different there is something wrong with the engineering process, not the language platform.
to post comments)