Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2013-11

Enum values and scope

2 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Martin

The below compiles. (2.6.2)

It shows that the value identifier of an enum, can be reached via a lot of different pathes.

Just want to be sure they are all intentional?

unit Unit1;
{$mode objfpc}{$H+}
interface
uses  Classes, SysUtils;
type  TEnum = (e1,e2,e3);
var   en1: TEnum;
implementation
procedure Foo;
begin
   en1 := Unit1.e1;
   en1 := TEnum.e1;
   en1 := Unit1.TEnum.e1;
   en1 := en1.e1;
   en1 := Unit1.en1.e1;
end;
end.

Reply by email

Sven Barth
to Martin
Martin wrote 22 lines
The below compiles. (2.6.2) It shows that the value identifier of an enum, can be reached via a lot of different pathes. Just want to be sure they are all intentional? unit Unit1; {$mode objfpc}{$H+} interface uses Classes, SysUtils; type TEnum = (e1,e2,e3); var en1: TEnum; implementation procedure Foo; begin en1 := Unit1.e1; en1 := TEnum.e1; en1 := Unit1.TEnum.e1;

Yes, all three intentional.

en1 := en1.e1; en1 := Unit1.en1.e1;

Not intentional and already fixed in 2.7.1 (don't know whether this was merged back to 2.6.x though)

end; end.

Regards,
Sven

Reply by email