RAD Studio (Common)
ContentsIndex
PreviousUpNext
E2083: Order of fields in record constant differs from declaration (Delphi)

This error message occurs if record fields in a typed constant or initialized variable are not initialized in declaration order.

program Produce;

type
  TPoint = record
    X, Y: Integer;
  end;

var
  Point : TPoint = (Y: 123; X: 456);

begin
end.

The example tries to initialize first Y, then X, in the opposite order from the declaration.

program Solve;

type
  TPoint = record
    X, Y: Integer;
  end;

var
  Point : TPoint = (X: 456; Y: 123);

begin
end.

The solution is to adjust the order of initialization to correspond to the declaration order.

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!