[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: cleanup patch / design rules

From: Ingo Ruhnke
Subject: Re: cleanup patch / design rules
Date: 25 Aug 2002 16:22:44 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

David Philippi <address@hidden> writes:

> If I guess right, those are only for caching purposes?

Most (or at least some) are parent-pointers. GUI elements have a
pointer to the GUIManager and such.

When the pointers are just there for caching purpose, they should
probally be removed and replaced with an inline getter method. If
calling the getter-method looks to ugly, like:

get_world()->get_pingu()->find_pingu(x, y)

one should add the caching varibable to the member function that uses
it and not to the class.

> How about using a reference instead? Change
> foo* bar = get_pointer() into foo& bar = *get_pointer()

That might work in a few cases, but in general references are to
inflexible (no null element, no way to reset them, etc.), so I avoid
them mostly in classes.

We should probally add some wrappers around new/delete to make it
easier to track them and to add some bookkeeping to catch double
deletes, etc.

JabberID: address@hidden 
ICQ:      59461927

reply via email to

[Prev in Thread] Current Thread [Next in Thread]