I've submitted this as a bug (similar to #62554 listed in
compiler\delphi\code generation\optimization, but not fixed in Delphi 5). A
workaround is to declare the array as const.
Cheers,
Carl
-----Original Message-----
From: Carl Reynolds [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, 8 August 2000 12:14 PM
To: Multiple recipients of list delphi
Subject: [DUG]: Array of variant: problems
I have a function that takes an array of variant constructed at runtime, but
if the resultant array length is zero I get insurmountable problems. A
simple example:
procedure Execute(A: array of variant);
begin
ShowMessage('Exiting...');
Exit;
ShowMessage(A[0]); // This never runs, but ANY reference causes problems
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
Execute([1]); // Works
Execute([]); // Sometimes "invalid variant operation",
// sometimes access violation in oleaut32.dll
// (depending on what other code is around)
end;
Can anyone tell me why?
Cheers,
Carl
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz