bewing wrote:
if you have an app to design (such as a kernel), and you have some decent programmer code it up in pure ASM, perhaps you will find that the final size of the executable is 4K, and it runs in 1 second.
If you take precisely that same app design, and you have some decent programmer code it up in pure C, you will almost certainly find that the final executable size is 40K, and it runs in 2 seconds.
If you take precisely that same app design, and you have some decent programmer code it up in C++, you will almost certainly find that the final executable size is 400K, and it runs in 4 seconds.
And spare me the "but C++ is just a superset of C, so they are always theoretically identical" BS. Not in reality, they aren't.
Bewing, this is wrong on so many levels...
Suffice it to say that hand-coded ASM vs optimizing compiler generated code tend to be comparatively the same in performance, or at least where handcoded code does offer better performance, the HLL code is more portable, and easier to maintain, as well as much more extensible. More importantly, since when does the number of machine instructions needed to complete a sequence diminish due to the HLL language you use?
Give a C and a C++ programmer the same program to code and given that they both come up with the same design and algorithm, and their understanding of their respective languages is optimal and they write condensed well thought out code, and the compilers used are equivalent in their optimizing powers, the executable will be about the same size in both cases, and certainly not double the size, or even 1.5x.
And give the ASM programmer the same thing to do with the same assumptions of skill and understanding and you get a bunch of shaved cycles due the fastest opcode possible for every sequence, the same functionality, and some hard-to-understand nonsense that nobody is ever going to maintain, and should it ever need to be ported would be completely useless, and given the assumption that the HLL programmers' compilers were very good at optimizing, the ASM coder's executable isn't going to be much smaller at all. I wasn't aware that using ASM somehow inherently compressed the opcodes and cut corners such that you could miss out instructions in a necessary sequence and still get the same sequence.
And also, the "C++ is a superset/derivative of C" thing is only ever used by bad C++ coders. From the time you hear people saying that, you can assume that they *think* they know C++, but have no idea what they're doing at all.
And,
The standard OO programming practices (code reuse, designing new code blobs to be reusable, dynamic memory allocation and fragmentation, etc.) cannot help but lead to code bloat.
I never thought I would hear someone tell me that dynamic memory allocation was a principle of object oriented programming.
C++ is an excellent tool in the right hands. End of story.
--Pointless ignorant argument is pointless and ignorant.
gravaera
17:56 < sortie> Paging is called paging because you need to draw it on pages in your notebook to succeed at it.