Oldham, Adam wrote:
I have been going through some test cases to test some instances of things.... This has led me to another question. It appears that it you define a record with a string in it and then declare it or new it. Both store the capacity of the string in the schema. And Both 0 out the entire string.
No, they don't:
program Foo;
procedure foo; var s: String (42); begin WriteLn (Length (s), ' ', Ord (s[1])) end;
begin foo end.
Gives -1073754596 135 on my machine.
program Foo;
type t = array [1 .. 15] of Integer;
var p: ^t; i: Integer; s: ^String;
begin New (p); for i := 1 to 15 do p^[i] := $12345678; Dispose (p); New (s, 50); WriteLn (Length (s^), ' ', Ord (s^[1])) end.
Gives 305419896 120 on my machine.
(Number may vary, of course.)
Could we perhaps close this topic now? Pascal variables are not initialized (unless they or their types are declared with initializers).
Frank