Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Const and debugger

Status
Not open for further replies.

igos

Programmer
Feb 10, 2004
5
US
Does anyone know if there is a problem passing a constant through 2 or more procedures?

For instance:
myCall('Hi);

procedure myCall(const theStr :string);
begin
myCall2(theStr);
end;

procedure myCall2(const theStr :string);
begin
// debug here
showMessage(theStr);
end;

The debugger does not seem to show the correct information.
Anyone know what is going on? Or this just soemthing to avoid?

Thanks,
Igos
 
Igos,

No, this works correctly, as far as I can tell. I've used techniques like this for years without problems.

To verify this, I created a form with an Edit box and a button. I named the edit box fldValue and then added the following code to the button's pushButton() event:

Code:
method pushButton(var eventInfo Event)
var
   strAValue String
endVar

   strAValue = fldValue.Value
   strAValue.view( "Before Calling Proc 1" )
   proc1( strAValue )
   strAValue.view( "After Calling Proc 1" )

endMethod

Next, I created two procedures on the button, called proc1 and proc2, respectively. Here's the code:

Code:
method proc1( const strAValue String )

   strAValue.view( "Before Calling Proc 2" )
   proc2( strAValue )
   strAValue.view( "After Calling Proc 2" )

endMethod

method proc2( const strAValue String )

   strAValue.view( "Inside Proc 2" )

endMethod

Finally, I placed a breakpoint on the line of code in proc2() and ran the form. I typed "Fred" into the edit box and clicked the button. As expected, the value moved correctly into the procedures and I was able to inspect it with the debugger when it hit the breakpoint.

Now, there are some things to remember when you're passing constant values into procedures (or methods), but I expect you already understand those. For example, you can't modify a constant parameter (because it's a constant parameter) and you can't pass constant parameters as variable parameters, for the same reason (e.g. constants can't be changed and the ObjectPAL parser enforces this).

This looks like a sample created due to a larger issue. Is it? If so, can you try to explain that? Perhaps we'll see see something in that.

Hope this helps...

-- Lance

P.S. There were issues with the debugger in older versions of Paradox, but most of those were ironed out by Paradox 5.0.1. If you're using an older version, try to upgrade to at least 5.0.1.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top