static static

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Wed Nov 11 13:36:24 PST 2009


Bill Baxter wrote:
> On Wed, Nov 11, 2009 at 1:16 PM, Andrei Alexandrescu
> <SeeWebsiteForEmail at erdani.org> wrote:
> 
>> One option that hasn't been mentioned:
>>
>> private ref int myInt() {
>>    static int theInt;
>>    return theInt;
>> }
>>
>> void fun(T)(T arg) {
>>    ... use myInt() ...
>> }
> 
> Is that a joke?  That just replaces global symbol theInt with global
> symbol myInt.  I don't see the win.
> 
> --bb

Forgot to mention that the function gives you the opportunity to 
initialize the object in the general case.

Andrei



More information about the Digitalmars-d mailing list