Clarification of __attribute__ init_priority

Vladimir Simonov sv@sw.ru
Tue May 17 18:54:00 GMT 2011


On 05/17/2011 08:38 PM, Vladimir Simonov wrote:
> On 05/17/2011 08:44 PM, Ian Lance Taylor wrote:
>> Vladimir Simonov<sv@sw.ru> writes:
>>
>>> 2. If 1 is true what about anonymous namespace? Is it considered the
>>> same namespace
>>> for different translation units?
>
> Thank you for you answer.
> One question below.
>>> But it means that init priority can't be set lover(value greater)
>>> then default.
>>> Is it correct?
>>
>> All objects with an init_priority attribute are constructed before any
>> object with no init_priority attribute.
> And are destructed _after_ any object with no init_priority attribute:)
> I just like to have a object destructed _before_ any object with no
> init_priority attribute. Is it possible? May be I'm conceptually wrong
> in my willing?

I meant _after_ "main" and _before_ any object with no init_priority attribute.
Sorry for stupid question. It may be achieved via static object created in
any function body. Only without priorities...

Best regards
Vladimir Simonov



More information about the Gcc-help mailing list