[fpc-devel] if-then-else expression

Sven Barth pascaldragon at googlemail.com
Sun Sep 7 20:37:02 CEST 2025


Michael Van Canneyt via fpc-devel <fpc-devel at lists.freepascal.org> schrieb
am Sa., 6. Sep. 2025, 20:53:

>
>
> On Sat, 6 Sep 2025, Sven Barth via fpc-devel wrote:
>
> > michael via fpc-devel <fpc-devel at lists.freepascal.org> schrieb am Do.,
> 4.
> > Sep. 2025, 09:29:
> >
> >> On 2025-09-04 08:55, Hairy Pixels via fpc-devel wrote:
> >>> On Sep 4, 2025 at 1:43:23 PM, michael via fpc-devel
> >>> <fpc-devel at lists.freepascal.org> wrote:
> >>>
> >>>> Personally, I think we already have too much intrinsics to begin
> >>>> with;
> >>>> no matter their behaviour. But that is another discussion
> >>>> entirely...
> >>>
> >>>  How so? The reason intrinsics are used is because they can’t be
> >>> replicated at runtime. If you remove them then you lose that
> >>> functionality entirely.
> >>
> >> As I wrote, for some it is needed. No arguments there.
> >>
> >> But AFAIK many regular functions such as Length(), Inc/Dec() etc. are
> >> also converted to intrinsics.
> >>
> >> No doubt for performance reasons, but I'd rather have as little as
> >> possible "compiler magic".
> >>
> >
> > Not performance reasons, but because they need to be usable by many types
> > and thus can't be expressed using ordinary Pascal in a typesafe way.
>
> Why inc() dec() cannot be expressed in a typesafe way ?
> We have InterlockedIncrement etc, and they do the same thing ?
>

Inc() and Dec() also work with enums which are custom types.

In each case, my point of view remains that the less intrinsics we have, the
> better it is.
>

I agree. Intrinsics should only be added when necessary.

Regards,
Sven

>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20250907/2804f2e0/attachment.htm>


More information about the fpc-devel mailing list