[Oberon] Standalone BlackBox programs was: GUI programming inOberon.
Douglas G. Danforth
danforth at greenwoodfarm.com
Thu Mar 31 04:36:22 CEST 2016
TYPE String = POINTER TO ARRAY OF CHAR;
That allows an arbitrary length string determined at run time.
VAR string: String;
NEW(string, 1000);
or you can do
string := NewString ('Hello, world!');
where
PROCEDURE NewString (IN x: ARRAY OF CHAR);
VAR string: String;
BEGIN
NEW(string, 1+LEN(x));
string$ := x$
RETURN string
END NewString;
-Doug Danforth
On 3/30/2016 6:25 PM, Lars wrote:
> Similarly, I find declaring an ARRAY OF CHAR (1000) obnoxious rather than
> just defining an arbitrary length STRING type without knowing exactly how
> long the string will be. IF you can't predict exactly what max value your
> integer is going to be, (standard pascal ranges) then who says you know
> your max string length either.
More information about the Oberon
mailing list