pingus-devel
[Top][All Lists]
Advanced

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

Re: Classes with only one instance


From: David Philippi
Subject: Re: Classes with only one instance
Date: Tue, 5 Nov 2002 14:26:54 +0100
User-agent: KMail/1.4.1

On Tuesday 05 November 2002 02:54, Henri Manson wrote:

> - No more need to implement init/deinit functions: the object is
> automatically destroyed at program exit - A direct object -> (slightly)
> better performance

What you mean is having a public static instance of a class. Sure, you won't 
have to deinit anything although it doesn't change anything about the need 
for an init.
The performance win may be achieved by inlining the current approach if need 
be.
The disadvantage is that the class object is always allocated wheter it's used 
or not and a direct access makes it harder to change something (like having 
one instance for every player).

I'm not really opposed to changing the code that way but I see little 
advantages and so I wouldn't do the actual work myself. If someone else 
changes it won't care all too much.

Bye David





reply via email to

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