Author: Dann Corbit
Date: 14:11:27 06/12/02
Go up one level in this thread
On June 12, 2002 at 17:02:48, Russell Reagan wrote: >On June 12, 2002 at 16:08:47, Bo Persson wrote: > >>For MSVC++ 7.0, The code for f() looks like this > >When did 7.0 come out? Or are you using a beta version? He means .net >>I especially notice that line 20 doesn't generate any code at all except for the >>stack space allocation (sub esp,520). > >So there is still a function call being made by the constructor? Or is that by >the function f()? That's a single assembly language instruction. It means subtract 520 from the stack because there is automatic data there. >And what do you mean by "C++ code bloat"? I assume it has something to do with >the ASM that was generated? It's a rumor. It does not happen in properly written programs. Like anything else, you can do it badly. For instance, if you write assignment operators and don't make a reference version or if you always pass huge objects by value instead of reference or rely heavily on RTTI or many of a large list of evil sins then you can get into trouble. Does anyone know of a useful computer language that you can't get into trouble with? People will speak of abuses as defects in the language (for instance, I can overload the + operator for some string class to mean "format the hard disk" but that is simply idiocy in action. You can just as easily do the same thing in C or BASIC by making a system call to do it and naming the function some innocuous thing. Well written C++ code will be about the same size and about the same speed of the equivalent C code. In the cases where there is some small performance hit (for instance heavy use of virtual member functions) the gain in abstraction is so valuable we would want to do it anyway.
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.