D pointers

Alexander Neundorf neundorf at kde.org
Mon Oct 3 12:21:07 BST 2005


Hi,

On Monday 03 October 2005 11:47, Simon Hausmann wrote:
...
> The problem I see with leaving unused variables around in classes is that
> the compiler doesn't warn you when you accidentially use them. Usually not
> initialized anymore then you're quickly in trouble when you write mVariable
> instead of d->newVariable.

When becoming unused they could be renamed to m_unusedSomething

> Besides that it probably doesn't hurt for integers and other primitive
> types, but if you have more complex types you still waste constructor and
> destructor time on them even if they're unused.

They could be replaced with simple types of the same size.

Ok, both are more or less ugly.
It would be cool if there was a way in C++ to hide private stuff completely 
from the outside, but it seems this is only possible with the private 
d-pointer and malloc :-/


Alex
-- 
Work: alexander.neundorf at jenoptik.com - http://www.jenoptik-los.de
Home: neundorf at kde.org                - http://www.kde.org
      alex at neundorf.net               - http://www.neundorf.net




More information about the kde-core-devel mailing list