What runs before main()?
Posted
by
MikimotoH
on Stack Overflow
See other posts from Stack Overflow
or by MikimotoH
Published on 2011-01-10T23:51:33Z
Indexed on
2011/01/10
23:53 UTC
Read the original article
Hit count: 127
c++
After testing on msvc8, I found:
- Parse GetCommandLine() to argc and argv
- Standard C Library initialization
- C++ Constructor of global variables
These three things are called before entering main().
My questions are:
- Will this execution order be different when I porting my program to different compiler (gcc or armcc), or different platform?
- What stuff does Standard C Library initialization do? So far I know setlocale() is a must.
- Is it safe to call standard C functions inside C++ constructor of global variables?
© Stack Overflow or respective owner