Watch, Follow, &
Connect with Us
Public Report
Report From: Delphi-BCB/Compiler/Delphi/Language/Dynamic Arrays    [ Add a report in this area ]  
Report #:  122179   Status: Closed
The "Magic" contstructor of dynamic arrays accepts comma at the end
Project:  Delphi Build #:  19.0.14356.6604
Version:    19.2 Submitted By:   Maxim Vlasov
Report Type:  Minor failure / Design problem Date Reported:  2/2/2014 6:23:35 AM
Severity:    Infrequently encountered problem Last Updated: 4/15/2014 6:32:28 PM
Platform:    All platforms Internal Tracking #:   47168
Resolution: Fixed (Resolution Comments) Resolved in Build: : XE6
Duplicate of:  None
Voting and Rating
Overall Rating: No Ratings Yet
0.00 out of 5
Total Votes: 10
Description
The "Magic" contstructor of dynamic arrays accepts comma at the end.

See also discussion about this topic at:
https://forums.embarcadero.com/thread.jspa?threadID=99907&tstart=0
Steps to Reproduce:
The following example successfully compiles on Delphi XE5 although it should not (the comma at the end of the constructor)
----------
procedure TestProc;
var
  a: TBytes;
begin
  a:=TBytes.Create(12, 13,);
end;
----------

The same example compiles on Delphi 2007 also.
Not a big deal, but code analysis tools and other parsing tools might expect correct behaviar in this case.
Workarounds
None
Attachment
None
Comments

Maxim Vlasov at 2/10/2014 12:30:16 PM -
Great to hear it was fixed so fast, please, don't forget to  check the line that was the inspiration behind this. Thanks

>> Fmx.Bind.Editors.pas
    Data.Bind.Components.RegisterObservableMember(TArray<TClass>.Create(
    TListBox,
    TComboBox, { <- here is the comma }
    ),
    'SelectedValue(Self)', sFmx);

Server Response from: ETNACODE01