Re: global and static object
- From: "Ben Voigt [C++ MVP]" <rbv@xxxxxxxxxxxxx>
- Date: Thu, 10 Apr 2008 11:01:27 -0500
George wrote:
Thanks Ben,
Initialization of globals is done by the CRT, because C programs can
use this. C++ global constructors are placed in the same list of
global initialization, so the CRT runs those without knowing whether
it is construction of a C++ object or initialization of a C variable.
You mean CRT just treat constructor invocation as a part of
initialization code to execute before executing main, and CRT has no
need to distinguish or identify what is doing in the initialization
(constructor invocation)?
Yes. The compiler create function pointers to all the initialization
functions, the linker places them into a special section, the CRT runs
through the whole list and executes the functions. It doesn't need to know
whether those functions call C++ constructors or not.
regards,
George
.
- Follow-Ups:
- Re: global and static object
- From: George
- Re: global and static object
- From: SvenC
- Re: global and static object
- References:
- global and static object
- From: George
- Re: global and static object
- From: SvenC
- Re: global and static object
- From: George
- Re: global and static object
- From: Alex Blekhman
- Re: global and static object
- From: George
- Re: global and static object
- From: Alex Blekhman
- Re: global and static object
- From: George
- Re: global and static object
- From: Alex Blekhman
- Re: global and static object
- From: George
- Re: global and static object
- From: Alex Blekhman
- Re: global and static object
- From: George
- Re: global and static object
- From: Ben Voigt [C++ MVP]
- Re: global and static object
- From: George
- global and static object
- Prev by Date: Re: global and static object
- Next by Date: Re: global and static object
- Previous by thread: Re: global and static object
- Next by thread: Re: global and static object
- Index(es):
Relevant Pages
|