- Length of string varies!
----boundary-LibPST-iamunique-1720535825_-_-
Content-type: text/plain
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
----boundary-LibPST-iamunique-1720535825_-_-
Content-type: application/rtf
Content-transfer-encoding: base64
Content-Disposition: attachment; filename="rtf-body.rtf"
e1xydGYxXGFuc2lcYW5zaWNwZzEyNTJcZnJvbXRleHQgXGRlZmYwe1xmb250dGJsDQp7XGYwXGZz
d2lzcyBBcmlhbDt9DQp7XGYxXGZtb2Rlcm4gQ291cmllciBOZXc7fQ0Ke1xmMlxmbmlsXGZjaGFy
c2V0MiBTeW1ib2w7fQ0Ke1xmM1xmbW9kZXJuXGZjaGFyc2V0MCBDb3VyaWVyIE5ldzt9fQ0Ke1xj
b2xvcnRibFxyZWQwXGdyZWVuMFxibHVlMDtccmVkMFxncmVlbjBcYmx1ZTI1NTt9DQpcdWMxXHBh
cmRccGxhaW5cZGVmdGFiMzYwIFxmMFxmczIwIEZvbGtzLFxwYXINCkkganVzdCBkaXNjb3ZlcmVk
IHRoYXQgdGhlIGxlbmd0aCBvZiBhIHN0cmluZyB2YXJpZXMgZGVwZW5kaW5nXHBhcg0KdXBvbiB3
aG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YXINCiAgICAgICAgQkVHSU5ccGFyDQogICAgICAgICAgICB4
IDo9ICJISSI7XHBhcg0KICAgICAgICAgICAgT3V0LlN0cmluZygiTEVOKHgkKT0iKTsgT3V0Lklu
dChMRU4oeCQpKTsgT3V0LkxuO1xwYXINCiAgICAgICAgICAgIEluc2lkZSh4JCk7XHBhcg0KICAg
ICAgICBFTkQgVGVzdDtccGFyDQpccGFyDQpFTkQgRm9vLlxwYXINClxwYXINCi1Eb3VnIERhbmZv
cnRoXHBhcg0KXHBhcg0KLS0tIEJsYWNrQm94XHBhcg0KLS0tIHNlbmQgc3ViamVjdCBIRUxQIG9y
IFVOU1VCU0NSSUJFIHRvIGJsYWNrYm94QG9iZXJvbi5jaFxwYXINClxwYXINCn0=
----boundary-LibPST-iamunique-1720535825_-_---
Received on Fri Sep 29 2006 - 17:29:26 UTC
This archive was generated by hypermail 2.3.0
: Thu Sep 26 2013 - 06:32:15 UTC