TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Rob Landley
from: Mike Bilow
date: 1996-01-28 01:53:06
subject: C++ Question

Rob Landley wrote in a message to Tom Brown:

> BTW, I realize that a more powerful language will tend to generate
> more .EXE per line of code.  With C++ having the capability to be so
> similar to C though, I can't help but wonder.  Thanks in advance.

 RL> Disable exception handling and your code should shrink back
 RL> down to normal.  (Exception handling bloats the code. 
 RL> Virtual functions bloat the code more.  Templates bloat the
 RL> code amazingly.)

Virtual functions will impose a run-time speed penalty, but I can't see why
they bloat the code noticeably.  Template functions can bloat the code,
especially if they are misused, but can also result in huge performance
advantages over comparative approaches.

 RL> My c++ programs use classes, but don't use throw or catch,
 RL> don't use virtual functions without a good reason (the
 RL> destructor doesn't have to be virtual if the class isn't
 RL> going to be a base class), and NEVER use templates. 

The destructor should be virtual if there are other virtual functions in
the base class, or you will leak memory at best and leave pointers dangling
at worst.  Templates have enormous power when used properly, as the
Standard Template Library demonstrates.

 RL> My theory on that is "if I wanted to slap together a piece
 RL> of garbage in five minutes of programming time, I'd use
 RL> visual basic.  The resulting .exe would probably be over a
 RL> megabyte."

I'm not sure I agree with your characterization of C++, since it is one of
the best tools available for coping with and encapsulating the complicated
interfaces present in modern environments such as Windows and OS/2. 
Writing PM code directly to the OS/2 API is quite hard and tedious without
an application framework.
 
-- Mike


--- 
* Origin: N1BEE BBS +1 401 944 8498 V.34/V.FC/V.32bis/HST16.8 (1:323/107)
SEEN-BY: 50/99 270/101 620/243 711/401 409 410 413 430 808 809 934 955
SEEN-BY: 712/407 515 517 628 713/888 800/1 7877/2809
@PATH: 323/107 170/400 396/1 270/101 712/515 711/808 809 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.