Frank D. Engel, Jr. wrote:
Not sure if this one has come up yet, but I have been experiencing some strange behavior in that some of my strings seem to disappear when used as parameters for procedure calls.
I'm not in a position to offer a demo program, and unfortunately, this does not seem to happen in every situation, but here is in essence what is happening. Consider:
TYPE STRING63 = STRING(63);
FUNCTION x : STRING63; { returns a nonempty string }
PROCEDURE y(z, t : STRING63); { ... }
VAR a, b : STRING63;
BEGIN a := 'hi'; y(x, a); <..>
Now if I try to use t within y, I should get the string 'hi', but it turns out to be an empty string (even if I WRITE(t) immediately after the opening BEGIN in the procedure). However, if I do this:
a := 'hi'; b := x; y(b, a);
then it works correctly.
There seems to be a problem with using a function returning a string (maybe just one with no parameters?) directly as an argument to a procedure. Storing the result in a variable then using the variable as the parameter solves the problem.
Obviously this creates a simple workaround, but it is still a bug...
Could you please send a test program? (I mean program as in something that can be given to the compiler, without "..." and omissions, plus instructions how to invoke it if it expects arguments or interactive input. The usual stuff.)
Which platform, which GPC version?
Frank