[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: cleanup patch / design rules
From: |
David Philippi |
Subject: |
Re: cleanup patch / design rules |
Date: |
Sat, 24 Aug 2002 21:22:16 +0200 |
User-agent: |
KMail/1.4.1 |
On Friday 23 August 2002 23:42, Ingo Ruhnke wrote:
> We have quite a few classes that hold reference pointers to other
> objects, so just deleting them will not do any good. But we should
> probally name these pointers differently or make them via some kind of
> smartpointer undeletable or something like that.
If I guess right, those are only for caching purposes?
How about using a reference instead? Change
foo* bar = get_pointer() into foo& bar = *get_pointer()
and there's no risk that anyone will ever try to delete it.
The only problem that remains is that a reference must be always initialized,
so if the cache variable isn't initialized in the constructor anyway, we
need a dummy. Something like namespace { foo baz; } at the beginning of the
.cxx would be enough, since you can now initialize every foo& to baz.
Bye David
- Re: cleanup patch / design rules, (continued)
- Re: cleanup patch / design rules, Ingo Ruhnke, 2002/08/23
- Re: cleanup patch / design rules, David Philippi, 2002/08/24
- Re: cleanup patch / design rules, Ingo Ruhnke, 2002/08/24
- Re: cleanup patch / design rules, Kenneth Gangstoe, 2002/08/24
- Re: cleanup patch / design rules, Kenneth Gangstoe, 2002/08/24
- Re: cleanup patch / design rules, Ingo Ruhnke, 2002/08/24
- Re: cleanup patch / design rules, Kenneth Gangstoe, 2002/08/24
- Re: cleanup patch / design rules, David Philippi, 2002/08/24
- Re: cleanup patch / design rules, Ingo Ruhnke, 2002/08/24
- Re: cleanup patch / design rules, David Philippi, 2002/08/25
Re: cleanup patch / design rules,
David Philippi <=