On 24 Mar 2008, at 12:53, L wrote:
So a record with an ansistring and an integer.. for example even
local scope..
Will be all zeros?
procedure test;
var somerec: Tsomerec;
begin
// these checks are okay?
if somerec.astring = '' if somerec.someint = 0
end;
i.e. above is not random data?
The ansistring is initialised on entry, the someint is not. The reason
that refcounted fields simply have to be initialised, is that
otherwise you'd get a crash as soon as you'd try to assign something
to them (since an assignment is basically "increfcount(source);
decrefcount(target); pointer(target):=pointer(source)", which would go
horribly wrong if target could contain garbage).
Jonas
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal