[opensource-dev] LLSingleton class question.

Oz Linden (Scott Lawrence) oz at lindenlab.com
Fri Dec 2 11:04:36 PST 2011


On 2011-11-19 23:48, lists.secondlife.com at trap.wereanimal.net wrote:
> Hi all.
>
> In the LLSingleton header, there is a comment:
>
> // Reference version of getInstance()
> // Preferred over getInstance() as it disallows checking for NULL
>
> My question is, is there a difference between
> MyClass::instance()->someFunction(); and
> MyClass::getInstance()->someFunction(); ?
>
> If not, is there a preference of using one over the other?
>
> Linden Lab viewer code has about 35% ::instance use vs.
> 65% ::getInstance use.

instance() is preferred, but newer, and we haven't spent the time to 
convert all existing code.



More information about the opensource-dev mailing list