Some more tips -- avoid implicit construction.

If you pass an object (instead of a reference or a pointer)
to a function, then a temporary duplicate of the original object
will be constructed and used in the routine.

Also, if your function returns an object, you'll be be
constructing a temporary to do that job.

Less common situation, but also possible: if object A is
used where object B required, and there is a constructor
for B that takes an A as a parameter, a B will be created
automagically.

You'd be surprised just how many temporary unnamed
objects can be created if you are not watching out for
such things.

The real overhead in C++ is the "invisible" stuff...

--
-Richard M. Hartman
[EMAIL PROTECTED]

186,000 mi/sec: not just a good idea, it's the LAW!


Stormgate Communications wrote in message <[EMAIL PROTECTED]>...
>
>In my experience (both on the Palm and in the embedded systems world) it's
>certainly possible to use C++ and stay almost as efficient as pure C,
>while gaining a lot of the advantages that C++ provides.
>
>I'd suggest approaching it as an embedded system (i.e. firmware) as
>opposed to a desktop application (i.e. software).
>
>Turn off RTTI and exceptions.  Avoid multiple inheritance.  Keep in mind
>that virtual functions may be a problem if launched without the globals
>being initialized.  Unrestricted use of new and delete may be a problem,
>especially on older devices with limited dynamic heap.
>
>Used wisely, the overhead can really be reduced to a bare minimum.  Take a
>look at any article on EC++.  A good web page to get started at is
>http://www.dinkumware.com/embed9710.html
>
>--
>Don Meyer
>Stormgate Communications
>
>





-- 
For information on using the ACCESS Developer Forums, or to unsubscribe, please 
see http://www.access-company.com/developers/forums/

Reply via email to