Board index » cppbuilder » Odd problem - please help!

Odd problem - please help!

Hi, I'm having a problem integrating a component I've made into our project.
When I create a new test project it works fine, but when I stick it into our
actual development it behaves oddly:

When this function gets called (say with NewMax = 23) the line FValueMax =
NewMax; appears not to execute.

void __fastcall TAnalogEdit::SetValueMax( double NewMax )
{
    if ( NewMax != FValueMax )
    {
        FValueMax = NewMax;     //  <-- This doesn't seem to work!

        if ( Value > ValueMax )
            SetValue( ValueMax );

        SetTextFromValue();
    }

Quote
}

FValueMax equals 0 both before and after the line. When I inspect FValueMax
and manually change its value, it either resets to 0 or becomes some odd
really small floating point value.

Since this code works in a small test project, but not in our main project,
I suspect its a linking error (or something like it). Has anyone encountered
this? Does anyone now how to fix it?

            D.

 

Re:Odd problem - please help!


On Mon, 6 May 2002 16:20:31 -0700, "Daniel"

Quote
<duk...@microcommander.com> wrote:
>Since this code works in a small test project, but not in our main project,
>I suspect its a linking error (or something like it). Has anyone encountered
>this? Does anyone now how to fix it?

I don't see how the linker could be responsible, since NewMax is a
stack parameter (I doubt that fastcall copes with doubles) and
FValueMax is a local class member. I'd open the CPU window in each
case and see if the executed code is different, or if the memory is
being trashed somehow.

Re:Odd problem - please help!


In article <3cd70f44_2@dnews>, Daniel says...

Quote
> Since this code works in a small test project, but not in our main project,
> I suspect its a linking error (or something like it). Has anyone encountered
> this? Does anyone now how to fix it?

No, but you could output some diagnostic message to see where and when
(and how often) SetValueMax are being called.

Of course, you could be using an old .obj file or the wrong copy of
the source file.
--
Rudy Velthuis (TeamB)

"I'd give my right arm to be ambidextrous." -- Brian Kernighan

Other Threads