[fpc-devel] Compile time functions

Sven Barth pascaldragon at googlemail.com
Sat Jul 21 19:51:33 CEST 2018


Martok <listbox at martoks-place.de> schrieb am Sa., 21. Juli 2018, 17:12:

> Am 21.07.2018 um 02:08 schrieb Sven Barth via fpc-devel:
> > The main problem is that not all functions that would be eligible for
> your
> > approach are also declared as inline thus their node trees would not be
> stored
> > inside the PPU and thus you could not work with them.
> I'm not sure I understand. Isn't the same true, with a new feature? The
> full
> node tree must be available, which basically means "has inlineinfo".
> Doesn't it?
>

Correct.


> > Additional benefit of the "pure" modifier: the compiler can check once
> the
> > method has been parsed whether it's pure or not and can thus error out
> in the
> > latter case.
> That is true, it is a more explicit declaration of intent.
> Maybe the codegen of pure can simply be implemented as generating inline
> info,
> but always replacing the calls with the simplified version. If it is
> already
> known that a function is pure, what I did with constexpr() would basically
> be
> guaranteed to work.
>

Pure functions would still have an ordinary generated body as there is no
reason that their address shouldn't be able to be taken (otherwise one
needs to declare wrappers for them). Other than that I personally favor the
explicit declaration of intent for such functions without the need for a
ConstExpr intrinsic.

Regards,
Sven

>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20180721/3b9bde33/attachment.html>


More information about the fpc-devel mailing list