[fpc-pascal] Setting record values

Ryan Joseph ryan at thealchemistguild.com
Sat Apr 1 09:59:56 CEST 2017

> On Apr 1, 2017, at 2:46 PM, Sven Barth via fpc-pascal <fpc-pascal at lists.freepascal.org> wrote:
> I haven't looked at it in detail, but it could be that both have similar efficiency. You could also add "inline" to the MakePoint function which should get rid of a potential temporary variable if the compiler doesn't do that already anyway.
> Alternatively you could also declare a constructor "TPoint.Make" or so (that despite its name doesn't do any dynamic memory allocation either) which you can declare as inline as well.

How is the constructor any different from the function?

> In the end you can always check the assembler code.

Not sure how to do that or what to look for. It appears to me without knowing how the compiler works that there would be some allocating and copying of memory which is more overhead than assigning a value directly. Maybe it’s totally trivial but if it is it’s something I should cut out of my design going forward.

	Ryan Joseph

More information about the fpc-pascal mailing list