Board index » cppbuilder » Re: Wierd constructor problem. Please help!

Re: Wierd constructor problem. Please help!


2007-04-19 03:17:49 AM
cppbuilder92
"Rob Rice" < XXXX@XXXXX.COM >writes:
Quote
I step into this contsructor of TClassA, a.object5 is calculated
correctly and I am able to 'watch' that object5 is 4.0 (as it should
be) before I exit the constructor. But when I step to the line of
code below the declaration of 'a', I get the above described wierd
behavior. Anyone have any idea what's going on? Thanks for much
for your help!
It's not clear if the problem you're seeing only occurs within the
de{*word*81}, or actually exhibits itself as a bad value when running your
program resulting in some invalid calculation.
It would also be very helpful if you could reduce the program to the
smallest possible example that maintains this issue, and post that.
It should be derived from your real code, with all of the irrelevant
lines removed. Then we can talk about concrete issues, rather than
simply guessing.
--
Chris (TeamB);
 
 

Re:Re: Wierd constructor problem. Please help!

Hello, All.
I am creating an instance of a TClassA object.
TClassA a(var1, var2, var3);
The above constructor calculates all the data members of the object 'a.'
There are six data members of TClassA, three floats and three user
defined types.
TypeA object1;
TypeB object2;
TypeC object3;
float object4;
float object5;
float object6;
The variables in the constructor, var1, var2, and var3 are used to
calculate the above data members. These data members are all private.
After I create 'a' via
TClassA a(var1, var2, var3);
I test the above six objects by doing
TypeA test1 = a.GetObject1();
TypeB test2 = a.GetObject2();
TypeC test3 = a.GetObject3();
float test4 = a.GetObject4();
float test5 = a.GetObject5();
float test6 = a.GetObject6();
and then I "watch" the above six objects, test1, test2, etc. Now I come
to the problem. All of the values are what they should be except the
float test5. If test5 should be, e.g., 4, I might see in the watch
window that test5 is 1.34432E-32. Here's the wierd part. If I watch
this variable
a.object5
it will display the correct value, 4.0. But test5 shows 1.34432E-32.
Morover, if I do this
float test7 = a.GetObject5();
float test8 = a.GetObject5();
float test9 = a.GetObject5();
float test10 = a.GetObject5();
I do not see test7 = test8 = test9 = test10. I get different values for
each of them! Also, if, when I get to
TClassA a(var1, var2, var3);
I step into this contsructor of TClassA, a.object5 is calculated
correctly and I am able to 'watch' that object5 is 4.0 (as it should be)
before I exit the constructor. But when I step to the line of code below
the declaration of 'a', I get the above described wierd behavior. Anyone
have any idea what's going on? Thanks for much for your help!
-Rob
 

Re:Re: Wierd constructor problem. Please help!

Please direct your browser at info.borland.com/newsgroups/ and
read the newsgroup guidelines. One of them asks us not to post the
same question to different newsgroups, but to pick the most
appropriate one and just post there. Thanks!
 

{smallsort}