[fpc-pascal] Operator overload bug

Ryan Joseph ryan at thealchemistguild.com
Mon Jul 23 06:19:39 CEST 2018



> On Jul 22, 2018, at 6:22 PM, Ben Grasset <operator97 at gmail.com> wrote:
> 
> Also, one other thing: you should really be specifying the right-hand-side array parameter as "const" there. If you don't, it will be copied in its entirety instead of being passed by reference. Basically just always pass everything as "const"  (or "constref" if it's specifically a record) unless you literally can’t.

Yeah sounds like a bug but I’ll wait for one the compile guys to verify that.

I belive I was told that const doesn’t actually perform any optimizations but constref does (for structs yes). I hope that’s right because I don’t want to feel an urge to type “const” every time I write a function. Honestly I don’t think I’ve ever used const but just  started using constref last year when I learned about it for the first time (good feature when ever it was added).

Regards,
	Ryan Joseph




More information about the fpc-pascal mailing list