[fpc-devel] type x = type byte // in overloaded params with/without var

Martin lazarus at mfriebe.de
Thu Aug 6 20:29:48 CEST 2009

I read up on  
I understand that assignment is still possible via := / due to implicit 

Just a question in the example below, 3 pairs of overload procedures.
And 3 types: Integer, t1, t2

Only the one with "var" param rejects the Integer.

Is this the only way do reject the integer?
I understand I could do a record type (and overload +/-), but I also 
whish to use bit-logig via and/or (which I believe I can not overload?)

To make it worse(actually better): if I use "string" instead of integer, 
byte, qword => all 3 give:
project1.lpr(30,3) Error: Can't determine which overloaded function to call

Worse because it's a differnet behaviour, and hence more complicated, 
less predictable (without even more knowledge)
Better, because at least it rejects, what I want it to reject

Best Regards

program Project1;
{$mode objfpc}{$H+}
  t1 = type byte;
  t2 = type qword;

procedure a(x: t1);
begin end;
procedure a(x: t2);
begin end;

procedure b(var x: t1);
begin end;
procedure b(var x: t2);
begin end;

procedure c(const x: t1);
begin end;
procedure c(const x: t2);
begin end;

v: integer;
v1: t1;
v2: t2;


More information about the fpc-devel mailing list