----boundary-LibPST-iamunique-923238448_-_-
Content-type: text/plain
The "$" operator makes the difference here.
You should write Out.Int(LEN(y$)) in PROCEDURE Inside.
Greetings, René Dorta.
Douglas G. Danforth wrote:
> Folks,
> I just discovered that the length of a string varies depending
> upon whether it is used directly or passed as an argument to
> a procedure for example
>
> VAR x: ARRAY 32 OF CHAR;
> x := "HI";
>
> will have length
> LEN(x$) = 2
> but will have length
> LEN(y) = 3
> when it is passed to a procedure with argument y.
>
> Here is the code that shows this.
>
> MODULE Foo;
> IMPORT Out:=StdLog;
>
> PROCEDURE Test*;
> VAR x: ARRAY 32 OF CHAR;
> PROCEDURE Inside (IN y: ARRAY OF CHAR);
> VAR i: INTEGER;
> BEGIN
> Out.String("LEN(y)="); Out.Int(LEN(y)); Out.Ln;
> (* dump the string *)
> FOR i:= 0 TO LEN(y)-1 DO Out.Char(y[i]) END;
> Out.Ln;
> END Inside;
> BEGIN
> x := "HI";
> Out.String("LEN(x$)="); Out.Int(LEN(x$)); Out.Ln;
> Inside(x$);
> END Test;
>
> END Foo.
>
> -Doug Danforth
>
> --- BlackBox
> --- send subject HELP or UNSUBSCRIBE to blackbox{([at]})nowhere.xy>
>
--- BlackBox
--- send subject HELP or UNSUBSCRIBE to blackbox{([at]})nowhere.xy
----boundary-LibPST-iamunique-923238448_-_-
Content-type: application/rtf
Content-transfer-encoding: base64
Content-Disposition: attachment; filename="rtf-body.rtf"
e1xydGYxXGFuc2lcYW5zaWNwZzEyNTJcZnJvbXRleHQgXGRlZmYwe1xmb250dGJsDQp7XGYwXGZz
d2lzc1xmY2hhcnNldDAgQXJpYWw7fQ0Ke1xmMVxmbW9kZXJuIENvdXJpZXIgTmV3O30NCntcZjJc
Zm5pbFxmY2hhcnNldDIgU3ltYm9sO30NCntcZjNcZm1vZGVyblxmY2hhcnNldDAgQ291cmllciBO
ZXc7fX0NCntcY29sb3J0YmxccmVkMFxncmVlbjBcYmx1ZTA7XHJlZDBcZ3JlZW4wXGJsdWUyNTU7
fQ0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PST-iamunique-923238448_-_---
Received on Mon Oct 02 2006 - 15:39:23 UTC