Re: Open array



Fons Rave wrote:
procedure OpenArray;

procedure Xxx(Bbb : array of boolean);
begin
end;

type TArrayOfBoolean = array of boolean;

procedure Yyy(Bbb : TArrayOfBoolean);
begin
end;

var B : array of boolean;
begin
Xxx([True, False, True]); // 1
B := [True, False, True]; // 2
Yyy([True, False, True]); // 3
end;

Delphi doesn't compile lines 2 and 3. All three look comparable. But they aren't. What's the solution to line 2 and 3 ?

There isn't one, as TArrayOfBoolean isn't an open array. AFAIK, you must fill the array manually (piece by piece).

Cheers,
Nicholas Sherlock

--
http://www.sherlocksoftware.org
.



Relevant Pages

  • Re: [OT] Re: Teaching new tricks to an old dog (C++ -->Ada)
    ... >> A packed array of boolean allocates one storage element to each bit. ... >> provided by Ada so that the program will properly represent ... The following example starts with the creation of a generic package ...
    (comp.lang.ada)
  • Re: [OT] Re: Teaching new tricks to an old dog (C++ -->Ada)
    ... >> A packed array of boolean allocates one storage element to each bit. ... >> provided by Ada so that the program will properly represent ... The following example starts with the creation of a generic package ...
    (comp.lang.cpp)
  • Re: IF/THEN Structure Issues - "Error: Too Many Continuations" PLS
    ... Your boolean array suggestion sounds viable. ... Dim TxtBoxVal As Integer ... >> Else bla bla ...
    (microsoft.public.vb.general.discussion)
  • Re: Bit operations in Ada
    ... I'm new to Ada and bitwise operations is a new challenge in this ... I started with an array of booleans of size 2**n, ... I'm ought to use directly an array of boolean and ... procedure Set (Bit: in Bit_Number; ...
    (comp.lang.ada)
  • Re: Optimizing AND of an 2d boolean array
    ... LineMask: array of LongWord; ... // prepare line mask ... I don't use longword shifts to fill the array, ... T2DBooleanArray = array of array of Boolean; ...
    (borland.public.delphi.language.basm)