[fpc-pascal] Scoped enums and inferred types

Mattias Gaertner nc-gaertnma at netcologne.de
Wed Feb 21 09:45:39 CET 2018


On Wed, 21 Feb 2018 09:38:17 +0700
Ryan Joseph <ryan at thealchemistguild.com> wrote:

>[...]Doesn’t the compiler know the type and can infer “A” is relative to the scoped enum? I understand there’s a possibility for name conflicts but you could just use the full name in that case.

I think this would be confusing:

{$scopedenums on}
type
	TMyType = (A, B, C);
{$scopedenums off}
var
  A: integer;
 
procedure DoThis (t: TMyType; i: integer);
begin
end;
 
DoThis(A,A);

Mattias



More information about the fpc-pascal mailing list