* How do I control the order of constuctors
@ 1999-12-31 6:21 John bebbington
1999-12-31 8:39 ` Greg Chicares
1999-12-31 22:24 ` John bebbington
0 siblings, 2 replies; 7+ messages in thread
From: John bebbington @ 1999-12-31 6:21 UTC (permalink / raw)
To: help-gcc
Hello,
Can anyone tell me how to control the order of calling class constuctors
which occur before the main().
I have several c++ classes that create object intances in their .cc files.
Example:
file a.h:
class a { }
external a;
file a.cc
......
a the_a;
file main.cc
#include "a.h"
#include "b.h"
main () {}
question: how can I ensure that object "the_a" is contructed before "the_b"
?
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: How do I control the order of constuctors
1999-12-31 6:21 How do I control the order of constuctors John bebbington
@ 1999-12-31 8:39 ` Greg Chicares
1999-12-31 22:24 ` Johnny Favorite (it means "Writhing Tentacle of Death")
1999-12-31 22:24 ` Greg Chicares
1999-12-31 22:24 ` John bebbington
1 sibling, 2 replies; 7+ messages in thread
From: Greg Chicares @ 1999-12-31 8:39 UTC (permalink / raw)
To: help-gcc
It's in the FAQ at
http://www.cerfnet.com/~mpcline/c++-faq-lite/
> Can anyone tell me how to control the order of calling class constuctors
> which occur before the main().
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: How do I control the order of constuctors
1999-12-31 8:39 ` Greg Chicares
@ 1999-12-31 22:24 ` Johnny Favorite (it means "Writhing Tentacle of Death")
2000-01-01 3:24 ` John bebbington
1999-12-31 22:24 ` Greg Chicares
1 sibling, 1 reply; 7+ messages in thread
From: Johnny Favorite (it means "Writhing Tentacle of Death") @ 1999-12-31 22:24 UTC (permalink / raw)
To: help-gcc
Greg Chicares wrote:
> It's in the FAQ at
> http://www.cerfnet.com/~mpcline/c++-faq-lite/
Well, I dug around there for 30 minutes or so and I can't find anything
about the ordering of constructors before main(). I'd always assumed it was
impossible to do anything about the ordering, that it was up to the
compiler. If the FAQ says something different I'd like to know what it is.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: How do I control the order of constuctors
1999-12-31 22:24 ` Johnny Favorite (it means "Writhing Tentacle of Death")
@ 2000-01-01 3:24 ` John bebbington
2000-04-01 0:00 ` John bebbington
0 siblings, 1 reply; 7+ messages in thread
From: John bebbington @ 2000-01-01 3:24 UTC (permalink / raw)
To: help-gcc
Johnny Favorite (it means "Writhing Tentacle of Death") wrote in message
<84k4ds02vdb@enews3.newsguy.com>...
>Greg Chicares wrote:
>> It's in the FAQ at
>> http://www.cerfnet.com/~mpcline/c++-faq-lite/
>
>Well, I dug around there for 30 minutes or so and I can't find anything
>about the ordering of constructors before main(). I'd always assumed it
was
>impossible to do anything about the ordering, that it was up to the
>compiler. If the FAQ says something different I'd like to know what it is.
>
>
Thanks for the link Greg,
I have found what I need is the following sections of the FAQs at
http://www.cerfnet.com/~mpcline/c++-faq-lite/
[10.10] What's the "static initialization order fiasco"?
[10.11] How do I prevent the "static initialization order fiasco"?
[10.12] How do I prevent the "static initialization order fiasco" for my
static data members?
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: How do I control the order of constuctors
2000-01-01 3:24 ` John bebbington
@ 2000-04-01 0:00 ` John bebbington
0 siblings, 0 replies; 7+ messages in thread
From: John bebbington @ 2000-04-01 0:00 UTC (permalink / raw)
To: help-gcc
Johnny Favorite (it means "Writhing Tentacle of Death") wrote in message
<84k4ds02vdb@enews3.newsguy.com>...
>Greg Chicares wrote:
>> It's in the FAQ at
>> http://www.cerfnet.com/~mpcline/c++-faq-lite/
>
>Well, I dug around there for 30 minutes or so and I can't find anything
>about the ordering of constructors before main(). I'd always assumed it
was
>impossible to do anything about the ordering, that it was up to the
>compiler. If the FAQ says something different I'd like to know what it is.
>
>
Thanks for the link Greg,
I have found what I need is the following sections of the FAQs at
http://www.cerfnet.com/~mpcline/c++-faq-lite/
[10.10] What's the "static initialization order fiasco"?
[10.11] How do I prevent the "static initialization order fiasco"?
[10.12] How do I prevent the "static initialization order fiasco" for my
static data members?
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: How do I control the order of constuctors
1999-12-31 8:39 ` Greg Chicares
1999-12-31 22:24 ` Johnny Favorite (it means "Writhing Tentacle of Death")
@ 1999-12-31 22:24 ` Greg Chicares
1 sibling, 0 replies; 7+ messages in thread
From: Greg Chicares @ 1999-12-31 22:24 UTC (permalink / raw)
To: help-gcc
It's in the FAQ at
http://www.cerfnet.com/~mpcline/c++-faq-lite/
> Can anyone tell me how to control the order of calling class constuctors
> which occur before the main().
^ permalink raw reply [flat|nested] 7+ messages in thread
* How do I control the order of constuctors
1999-12-31 6:21 How do I control the order of constuctors John bebbington
1999-12-31 8:39 ` Greg Chicares
@ 1999-12-31 22:24 ` John bebbington
1 sibling, 0 replies; 7+ messages in thread
From: John bebbington @ 1999-12-31 22:24 UTC (permalink / raw)
To: help-gcc
Hello,
Can anyone tell me how to control the order of calling class constuctors
which occur before the main().
I have several c++ classes that create object intances in their .cc files.
Example:
file a.h:
class a { }
external a;
file a.cc
......
a the_a;
file main.cc
#include "a.h"
#include "b.h"
main () {}
question: how can I ensure that object "the_a" is contructed before "the_b"
?
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2000-04-01 0:00 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-12-31 6:21 How do I control the order of constuctors John bebbington
1999-12-31 8:39 ` Greg Chicares
1999-12-31 22:24 ` Johnny Favorite (it means "Writhing Tentacle of Death")
2000-01-01 3:24 ` John bebbington
2000-04-01 0:00 ` John bebbington
1999-12-31 22:24 ` Greg Chicares
1999-12-31 22:24 ` John bebbington
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).