This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: order of constructors


Bill Gatliff <bgat@billgatliff.com> wrote:

> Does this work?
> 
> http://gcc.gnu.org/onlinedocs/gcc-3.3.2/gcc/C---Attributes.html#C++%20Attributes

 I like many others reading these messages offline, may feel frustrated when these
URL addresses are used instead of writing about the subject itself.  Sending HTML
(or was it something else rubbish the current mailers try to send as default) instead
of plain text seems to be forbidden on this list... But are these kind of URL-references
really preferred without any clue words?

 Most GCC owners should have the GCC-manuals on-line as PDF-files or HTML-pages
on their workstations. So why to dial-up and see what these references are telling?

 Anyway I would assume the URL telling about the old 'embedded-use' attribute :

---------------------------------- clip ----------------------------------------------------------
5.8 C++ Specific Attributes, init priority

In C++, you can define static and global objects with constructors, or initialize static
and global variables from a function. This means that the constructors or functions are run
before the rest of your program starts. However, when you have these objects spread over
multiple files, the C++ standard does not specify the order in which they are initialized,
and for all practical purposes the order is random. For an embedded system, this can be
a problem, as you may want to ensure that a static scheduler object is initialized before
static threads can attach to it, or that devices are initialized before they are used. GNU
C/C++ solves this problem by allowing you to define a priority when the static or global is
declared.
---------------------------------- clip ----------------------------------------------------------

which I remember adding into my gcc-2.95.3 sources as patches from some gnupro-2.9
sources. The previous was taken from my gcc-2.95 manual...

 I have never tried this attribute though, so my question would be when this did appear in
the FSF sources?  My gcc-3.2.x manuals tell it being on them already, but was it already
in gcc-3.0 or gcc-3.1 or did it come first in gcc-3.2 ?  Anyway as the replies tell, its existence
is not very well known even now...
 
Cheers, Kai


------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]