Re: [fpc-devel] Operator overloading and {$mode delphi}

2019-04-13 Thread Ben Grasset
On Sat, Apr 13, 2019 at 6:04 PM Sven Barth via fpc-devel < fpc-devel@lists.freepascal.org> wrote: > Maybe we should mention that in the documentation... > AFAIK it's never been possible to use FPC-style operator overloading in mode Delphi... is it supposed to be allowed? For example: unit

Re: [fpc-devel] Operator overloading and {$mode delphi}

2019-04-13 Thread Sven Barth via fpc-devel
On 4/13/19 11:28 PM, Bart wrote: > Hi, > > This example is taken from the documentation: > https://www.freepascal.org/docs-html/ref/refse103.html > > {$mode delphi} //compiles in {$mode objfpc} or {$mode fpc} > {$h+} > > Type > TMyRec = record a,b : integer; end; > > operator = (x,y :

[fpc-devel] Operator overloading and {$mode delphi}

2019-04-13 Thread Bart
Hi, This example is taken from the documentation: https://www.freepascal.org/docs-html/ref/refse103.html {$mode delphi} //compiles in {$mode objfpc} or {$mode fpc} {$h+} Type TMyRec = record a,b : integer; end; operator = (x,y : TMyRec) r : string; begin if (x.a=y.a) and (x.b=y.b) then

Re: [fpc-devel] Operator overloading

2019-04-13 Thread Bart
program op; uses opovr; procedure test; var d: dword; begin d:=(65 shl 24) or (66 shl 16) or (67 shl 8) or 68; if (d<>'ABCD') then writeln('d <> "ABCD"') else writeln('d = "ABCD"'); end; begin test; end. unit opovr; {$mode objfpc} {$H+} interface operator = (L: dword; R:

Re: [fpc-devel] Operator overloading

2019-04-13 Thread Bart
On Sat, Apr 13, 2019 at 3:49 PM Jonas Maebe wrote: > It's not possible. OK. > You can use a unit that is compiled in e.g. mode ObjFPC in a unit > compiled in MacPas mode, and then the latter will use the overloaded > operators from the former. So, allowing it in other modes cannot be

Re: [fpc-devel] Operator overloading

2019-04-13 Thread Jonas Maebe
On 08/04/2019 21:39, Bart wrote: 1. Is operator overloading possible at all in MacPas mode (does it need some modeswitch)? It's not possible. 2. If this is not the case, then why forbid this particular operator overload at all? You can use a unit that is compiled in e.g. mode ObjFPC in a

Re: [fpc-devel] Operator overloading

2019-04-13 Thread Bart
On Mon, Apr 8, 2019 at 9:39 PM Bart wrote: > Forgive me for the long introduction before I ask the question. Nobody? Or am I unforgiven? -- Bart ___ fpc-devel maillist - fpc-devel@lists.freepascal.org