delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/10/19/11:18:57

From: "Andreas Bierhals" <bierhals AT studserv DOT stud DOT uni-hannover DOT de>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: VERY STRANGE PROBLEM...
Date: 19 Oct 1997 12:12:33 GMT
Organization: RRZN - Newsserver
Lines: 66
Message-ID: <01bcdc88$66652960$26b14b82@bierhals>
References: <34481ACA DOT 7D513B88 AT nbnet DOT nb DOT ca>
NNTP-Posting-Host: h38.stud.uni-hannover.de
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Hi Jason!

If I understood you well, you have (i) two classes, A and B,
and (ii) two files, a.hpp and a.cpp. 
The declaration of class A is in a.hpp, while its definition is
in a.cpp. However, the class B is declared AND defined in
a.cpp in order to be hidden. Furthermore you defined a static
instantiation of B in a.cpp with a fixed size-Argument for
the constructor.

I played around a little with this configuration and found
out that sometimes, the order of invoking the constructors
of A and B may be wrong (i.e. The constructor of A is invoked
BEFORE the one of class B).
I have attached to files, "test.h" and "test.cc" which illustrate
this problem. To compile them, type:

gcc -o test.exe test.cc

Before compiling, there are two comment lines in test.cc 
(line 26 and line 48)
which look like
"// ##########", and directly after them "// A testClass(...)".
One of the two instantiations of A must be activated before
compiling.

Invoking the two versions of test.exe (with the different positions of
the line "A testClass(...)" should illustrate the pitfall, that I
suppose to occur in your program.

                    Sincerely,

             Andreas Bierhals
begin 600 test.cc
M(VEN8VQU9&4B=&5S="YH(@T*#0IC;&%S<R!"#0I[#0H@('!U8FQI8SH-"B @
M0BAI;G0@<RD[#0H@('9O:60@<F5V97)T*&-H87(@*G(I.PT*#0H@('!R;W1E
M8W1E9#H-"B @8VAA<B J8G5F.PT*?3L-"@T*0CHZ0BAI;G0@<RD@>PT*("!P
M<FEN=&8H(DYO=R!C<F5A=&EN9R!C;&%S<R!"+EQN(BD[#0H@(&)U9B ](&YE
M=R!C:&%R6W-=.PT*?0T*#0IV;VED($(Z.G)E=F5R="A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#0I[#0H@('!U8FQI8SH-"B @02AC:&%R("IC*3L-"B @=F]I9"!P<FEN
M=%]B=68H=F]I9"D[#0H-"B @<')O=&5C=&5D DOT  AT T*("!C:&%R("IB=69F97([
(#0I].PT*#0II
`
end

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019