- To: Maxim Yegorushkin <maxim.yegorushkin@xxxxxxxxx>
- Subject: Re: global object constructors and constructor function priorities
- From: Ian Lance Taylor <iant@xxxxxxxxxx>
- Date: Fri, 18 May 2012 06:59:50 -0700
- Cc: gcc-help@xxxxxxxxxxx
- Comment: DKIM? See http://www.dkim.org
- Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys
- In-reply-to: <CAMg=2z+4iBArU2WRtQZgBt-DcfooGvkrObKgP4kn4ph--aOCzQ@mail.gmail.com> (Maxim Yegorushkin's message of "Fri, 18 May 2012 13:21:43 +0100")
- User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)
Maxim Yegorushkin <maxim.yegorushkin@xxxxxxxxx> writes:
> I am reading http://gcc.gnu.org/onlinedocs/gcc-4.7.0/gcc/Function-Attributes.html#Function-Attributes
> where it talks about constructor and destructor function attributes:
>
> The priorities for constructor and destructor functions are the
> same as those specified for namespace-scope C++ objects.
The sentence is in a paragraph discussing the optional integer priority
argument. It only applies to the priority argument. It does not apply
in general.
If you don't use an explicit priority, the order of execution of
functions with the constructor attribute and C++ global constructors is
not specified. It's unusual to use the constructor attribute in C++
code.
Ian
[Linux C Programming]
[Linux Kernel]
[eCos]
[Fedora Development]
[Fedora Announce]
[Autoconf]
[The DWARVES Debugging Tools]
[Yosemite Campsites]
[Yosemite News]
[Linux GCC]