This is the mail archive of the gcc@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] | |
harsha@vishvakannada.com wrote: > > I have a problem with my program compiled using gcc in linux. In windows same code works fine. > > I have two cpp files having to global objects of two different classes > > I want to know which constructor is get called first ? > how can I change the order ? The initialization order of statics and global variables between compilation units is undefined. So you can't change the order of initialiation of these objects in portable manner. It's also a good practice to minimize the use of global and static objects in general. If you have to use them be very careful with respect to their order of initialization. -- Regards, Alexander
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |