4 ms·
Code that takes longer to compile is not better, more efficient, more maintainable. A C++ compiler will take longer than a C compiler to produce the same code f
by eliasmacpherson 13y ago
Code that takes longer to compile is not better, more efficient, more maintainable. A C++ compiler will take longer than a C compiler to produce the same code from some C source code, providing it will compile, because they are not an exact match. I could argue about compilation times until I am very blue in the face, but I'll leave it at that and I won't do it here.
I am saying that I think that it will take more C++ than C to write malloc or strlen, because of casting to void, so I am saying he's wrong. I could be mistaken however.
I think a wrapper is less of stretch, to suggest that a library be rewritten in C++ as a defence of the simplicity of C++ would suggest a very large amount of cognitive dissonance.
- CJefferson 13y ago"A C++ compiler will take longer than a C compiler to produce the same code from some C source code" While this is technically true, I have in the past measured this, and the difference on my code when optimising was < 5%, so I think nothing to worry about.
- eliasmacpherson 13y agoBasically if you had to get a distro out the door, and 100 days to do it, given your example, if the code was written in C with a C compiler, you'd be done 5% quicker. It's not the sort of thing you can measure once and just forget about. Then of course by moving to a C++ compiler, the temptation is to use features that take forever to compile!
- eliasmacpherson 13y agoThis isn't really relevant to your point or to the discussion, but this is not the first time I've heard of these kinds of improvements in compile time: http://tech.slashdot.org/comments.pl?sid=4410261&cid=45332543 http://tech.slashdot.org/comments.pl?sid=4410261&cid=4533254... Obviously, what's being compiled is not exactly equivalent but the time difference is startling.