This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


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: CTORs for static elements


Am Dienstag, 6. Juni 2006 02:09 schrieb Perry Smith:
> I have a class like:
>
> class f {
> public:
>    f() : l(-1) { }
>
> private:
>    int l;
> };
>
> I then have a global static instance of f.  Is GCC going to create a
> CTOR function and call it when the program starts up or is it going
> to just put f::l into an initialized data area?  My other question
> (not gcc specific) is if this is specified in the C++ language?

I would say C++ defines that the CTOR is created at compilation time but 
called when the program starts and that's how gcc should behave.


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