Watch, Follow, &
Connect with Us
Public Report
Report From: Delphi-BCB/Compiler/Delphi    [ Add a report in this area ]  
Report #:  87168   Status: Closed
var parameter not reconized
Project:  Delphi Build #:  Embarcadero? De
Version:    14.0 Submitted By:   Claus Freitag
Report Type:  Basic functionality failure Date Reported:  8/12/2010 7:49:05 AM
Severity:    Serious / Highly visible problem Last Updated: 12/10/2013 6:29:33 PM
Platform:    All platforms Internal Tracking #:  
Resolution: Duplicate (Resolution Comments) Resolved in Build: : XE5 Update2
Duplicate of:  118866
Voting and Rating
Overall Rating: No Ratings Yet
0.00 out of 5
Total Votes: None
Description
Compiler error E2197 with
  TaCurrency = array of Currency;
as var-parameter

type
  TaCurrency = array of Currency;
procedure DoIncrArraySize(
  var   vaArray    : TaCurrency;   // Parameter-Array
  const piCount    : Integer;      // neue Anzahl der g·tigen Array-Elemente
  var   viSize     : Integer);     // = Length(vaArray)
//  const pmNextSize : TmNextASize); // n?hste Array-Gr?e
{ Hauptprozedur f· Betr?e }
var
  liSize           : Integer;      // notwendige Array-Gr?e
begin
    liSize := piCount * 2;
    SetLength(vaArray, liSize);
    FillChar(vaArray[viSize], SizeOf(Currency) * (liSize - viSize), uiNullByte); // Compiler-Fehler
    viSize := liSize;
end; // DoIncrArraySize
Steps to Reproduce:
s. above
Workarounds
Typecast
FillChar((@vaArray[viSize])^, SizeOf(Currency) * (liSize - viSize), uiNullByte);

seems to work
Attachment
None
Comments

Tomohiro Takahashi at 8/12/2010 8:37:50 PM -
> uiNullByte
I build your code, but I get  an error [E2003 Undiefined Indentifier 'uiNullByte'].
So, could you please attach entire sample project to confirm your issue?

Server Response from: ETNACODE01