Is it possible to use dynamic arrays in gpc?
Waldek Hebisch
hebisch at math.uni.wroc.pl
Thu Feb 7 04:31:07 CET 2008
Ohonin Yuriy wrote:
>
> The main advandage of Pascal is that strong typization mekes working whith
> pointers and dynamic structures very easy. If i need to write my own class
> for Normal Strings, and for most of functions to work whith it - it is better
> switch to fpc, or just c++ - it's already written.
>
Well, currently gpc support trurly dynamic strings (and arrays) only
via pointers, like:
type
StrPtrT = ^String;
function blanks(n : integer) : StrPtrT;
var result : StrPtrT;
i : integer;
begin
new(result, n);
for i := 1 to n do
result[i] := ' ';
blanks := result;
end;
You may look at the 'stringschemademo.pas' demo program to see
some possibilites offered by gpc strings.
--
Waldek Hebisch
hebisch at math.uni.wroc.pl
More information about the Gpc
mailing list