|
Boost : |
From: Dave Abrahams (abrahams_at_[hidden])
Date: 2000-02-01 01:12:16
on 2/1/00 1:00 AM, Greg Colvin at gcolvin_at_[hidden] wrote:
> From: Dave Abrahams <abrahams_at_[hidden]>
>> ...
>> // stupid, slow implementation just to keep this all in a header file
>> // for real speed turn this into a static data member.
>> static count*& free_list() { static count* p = 0; return p; }
>
> Is this really so stupid and slow? The compiler/linker will have to
> store the static count* as data somewhere, and the free_list() function
> should get inlined.
I'm used to function-static variables being implicitly wrapped by a separate
bool saying whether they're initialized or not (so they in fact are
initialized when the function is first entered). Maybe some compilers only
make me pay for classes in that way, but I don't know so I assume that I'm
paying for it.
-Dave
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk