Re: Delphi.NET



Hans-Peter Diettrich wrote:
Daniel Hobson wrote:
You cannot do this either in Turbo Delphi.NET.

Since arrays need initialization, .NET will not allow this in a variant type record.

I wonder what initialization *static* arrays require?

Same as dynamic ones.

As can be seen from sizeof() of
TTest = record
buf: array [0..3] of byte;
end;
no additional information is part of the record. So what the heck is that information, that is pretended to need initialization???

That record actually has a number of methods. One of them is named __Initialize__, and it's implemented like this:

procedure TTest1.__Initialize__;
begin
self.buf := New(array[4] of Byte)
end;

That's the way Reflector shows the code, anyway.

--
Rob
.



Relevant Pages

  • Re: Delphi.NET
    ... Since arrays need initialization, .NET will not allow this in a variant type record. ... As can be seen from sizeof() of ... TTest = record ...
    (comp.lang.pascal.delphi.misc)
  • Re: How to reduce Zero Initialised region.
    ... Zero Initialized region to the Non-Zero Initialized region? ... since these global arrays are used through out the code. ... The code section gets a little bigger for the initialization code. ... RAM requirement won't go down. ...
    (comp.lang.c)
  • Re: Ada.Containers.Vectors - querying multiple elements
    ... Whenever you want to use legacy code that works on arrays? ... then that initialization won't happen. ... debugging routines which turns an array into a formatted output ...
    (comp.lang.ada)
  • Re: Is Array Empty
    ... IsEmpty applies only Variants. ... It has nothing to do with arrays ... IsEmpty function (doesn't work...only tests for initialization, ... 'Public Function IsArrayEmpty(vAnyArray As Variant) As Boolean ...
    (microsoft.public.vb.general.discussion)
  • Re: Array initalization doubt.
    ... >> Specifically dealing with automatic storage, ... The compiler has to generate code to perform the ... >> initialization, which is a foolishly wasteful endeavor when the ... > unions, arrays of structures containing unions, and so on) always ...
    (comp.lang.c)