Lazarus

Free Pascal => General => Topic started by: simone on July 16, 2022, 07:14:05 pm

Title: Compiler intrinsic functions
Post by: simone on July 16, 2022, 07:14:05 pm
I know there are some compiler intrinsic functions, i.e. functions that can be used at compile time, such as length, default, sizeof, inc, dec.

Just for the sake of completeness, I wanted to know where this kind of functions are all listed and described. I have not found it. I apologize if I missed it. Thank you.
Title: Re: Compiler intrinsic functions
Post by: 440bx on July 16, 2022, 07:25:37 pm
There was a similar question a while back. 

You can find the discussion at : https://forum.lazarus.freepascal.org/index.php/topic,54525.msg405034.html#msg405034

but, as PascalDragon mentioned in that thread, the arithmetic operations were not documented at the time and, that may still be the case (I don't know either way.)

HTH.
Title: Re: Compiler intrinsic functions
Post by: simone on July 16, 2022, 08:33:07 pm
Thanks for the reply. The compiler intrinsic functions are individually described in the official documentation, but I cannot find a list with all the functions of this type.

Unfortunately there are various important features, some recently implemented, which are not yet documented in the language reference guide, but only in the forum or in the user changes wiki for a given compiler version. The first example that comes to mind: generic free standing procedures / functions. No mention in the language reference guide.
Title: Re: Compiler intrinsic functions
Post by: Bi0T1N on July 16, 2022, 09:01:51 pm
Thanks for the reply. The compiler intrinsic functions are individually described in the official documentation, but I cannot find a list with all the functions of this type.

Unfortunately there are various important features, some recently implemented, which are not yet documented in the language reference guide, but only in the forum or in the user changes wiki for a given compiler version. The first example that comes to mind: generic free standing procedures / functions. No mention in the language reference guide.

Did you check the documentation that is generated on a daily basis or the general documentation which dates back to the last official release (3.2.2)?
As long as it is already described here (https://gitlab.com/freepascal.org/fpc/documentation) it should be visible the next day here (https://www.freepascal.org/daily/daily.html) :)
Title: Re: Compiler intrinsic functions
Post by: simone on July 16, 2022, 09:12:36 pm
I periodically consult the daily documentation. And I don't think there are, at the moment, some of the new language features present in the current (and most recent) release of compiler.

However, in principle, when the x.y.z version of the compiler is released and, at the same time, the language reference guide for the x.y.z version is published, I would expect it to be updated with the new features. In the daily documentation I expect to find the features implemented in the trunk version of the compiler.
Title: Re: Compiler intrinsic functions
Post by: marcov on July 16, 2022, 10:38:22 pm
You might want to have a look at rtl/inc/system.fpd.

This are fake declarations of build-ins for documentation purposes.
Title: Re: Compiler intrinsic functions
Post by: simone on July 16, 2022, 11:58:31 pm
This tip is really interesting. I knew this file, with which I have stumbled upon casually in the past, but I did not remember its existence.

The declarations in this files are in fact the complete documentation of all compiler intrinsic functions.

Thank you so much for this very useful tip.
Title: Re: Compiler intrinsic functions
Post by: PascalDragon on July 17, 2022, 11:54:36 am
However, in principle, when the x.y.z version of the compiler is released and, at the same time, the language reference guide for the x.y.z version is published, I would expect it to be updated with the new features. In the daily documentation I expect to find the features implemented in the trunk version of the compiler.

Well, welcome to real life where things often aren't as one wants them.
Title: Re: Compiler intrinsic functions
Post by: simone on July 17, 2022, 01:02:00 pm
I'm an engineer and have worked in IT for several decades. I know the real world and what I have written is normal, not utopian.
Title: Re: Compiler intrinsic functions
Post by: marcov on July 17, 2022, 01:25:04 pm
I'm an engineer and have worked in IT for several decades. I know the real world and what I have written is normal, not utopian.

Then I'm sure next release candidate you will find all omissions.
Title: Re: Compiler intrinsic functions
Post by: simone on July 17, 2022, 01:38:11 pm
If not, no problem for me, as I only use fpc for hobby projects, not in my professional work. I'm sincerely grateful for the tremendous work that is being done by the core development team. Mine was not a criticism.
Title: Re: Compiler intrinsic functions
Post by: marcov on July 17, 2022, 02:13:10 pm
If not, no problem for me, as I only use fpc for hobby projects, not in my professional work. I'm sincerely grateful for the tremendous work that is being done by the core development team. Mine was not a criticism.

My remark was harsher than it was meant. But do consider stepping out of the comfort zone occasionally and try fixes and/or release candidates, and don't wait till it is all done and dusted. We need the eyeballs.
Title: Re: Compiler intrinsic functions
Post by: simone on July 17, 2022, 04:11:35 pm
Certainly I should do more. Indeed, in all my honesty, these years I have received from this community, more than I have given. I can assure you that my gratitude for your work is endless. In my own small way, I have reported many bugs and, thanks to my role in a large government institution, in my context I have carried out a fervent evangelization activity. Because I think the lack of communication / marketing is one of the reasons that limits the spread of object pascal / fpc / lazarus / delphi. Too many (almost all) in IT (and CS) think that Pascal is just an obsolete language for educational purposes.

Returning to the documentation, it disturbs me that it is spread in too many different places: language reference guide (which should be the only official source), forum, wikis written by users (sometimes inaccurate, duplicated and obsolete), new features wiki, developer mailing list, user mailing list, etc.

For example, the important new language features introduced in fpc 3.2.0 are already described here:

https://wiki.freepascal.org/FPC_New_Features_3.2.0

but after two years they still haven't been added in the language reference.

I dream of a single, complete and updated official language specification, as happens with the other languages ​​I know.
Title: Re: Compiler intrinsic functions
Post by: Thaddy on July 17, 2022, 09:31:08 pm
The latter is weird, because Michael adds everything to the docs when a proper bug report against documentation is formulated  and usually very fast.
So file a bug report against documentation....
Also note it may already be in trunk/main, but building the docs from source is not always easy depending on platform.
Title: Re: Compiler intrinsic functions
Post by: simone on July 17, 2022, 09:59:05 pm
I reported the problem on Mantis last year. I will report it again on gitlab.

Post Scriptum: Michael is fantastic. When I report a bug to him by sending an email, he fixes it in real time!
Title: Re: Compiler intrinsic functions
Post by: PascalDragon on July 18, 2022, 02:01:10 pm
I'm an engineer and have worked in IT for several decades. I know the real world and what I have written is normal, not utopian.

Unlike you we aren't getting paid for this however. We work on FPC in our free time.

Returning to the documentation, it disturbs me that it is spread in too many different places: language reference guide (which should be the only official source), forum, wikis written by users (sometimes inaccurate, duplicated and obsolete), new features wiki, developer mailing list, user mailing list, etc.

The Language Reference Guide already is the only official source and we often repeat this. However documentation for new features is usually only done once a new release approaches until then the New Features Trunk (https://wiki.freepascal.org/FPC_New_Features_Trunk) page or the announcement mails for the corresponding feature are the official documentation.
Title: Re: Compiler intrinsic functions
Post by: simone on July 18, 2022, 07:02:20 pm
I contribute to various opensource projects without being paid.
Title: Re: Compiler intrinsic functions
Post by: BobDog on July 18, 2022, 08:10:03 pm

I don't have this
rtl/inc/system.fpd  (given by marcov)
in my 3.2.2 distro.

In fact I don't have a rtl folder
only:
bin
doc
fpmkinst
units
and no rtl anywhere in these?



Title: Re: Compiler intrinsic functions
Post by: dsiders on July 18, 2022, 09:08:59 pm

I don't have this
rtl/inc/system.fpd  (given by marcov)
in my 3.2.2 distro.

In fact I don't have a rtl folder
only:
bin
doc
fpmkinst
units
and no rtl anywhere in these?

That's the path to FPC binaries. You need to look in the path for FPC source. fpcupdeluxe tends to put those in  directory called fpcsrc. An installer puts them in source - same as the name used on Git.
Title: Re: Compiler intrinsic functions
Post by: simone on July 18, 2022, 09:15:14 pm
For example, in my pc with Windows, the full path is:

C:\lazarus\fpc\3.2.2\source\rtl\inc\system.fpd
Title: Re: Compiler intrinsic functions
Post by: BobDog on July 18, 2022, 09:48:41 pm

Thanks.
I only have the free pascal compiler, not the lazarus ide and source code.


Title: Re: Compiler intrinsic functions
Post by: Thaddy on July 23, 2022, 11:24:01 am
Then you can never easily know version and features. Having the sourcecode is essential, on top of the official documentation for your version and NOT the wiki which is often not correct for newer versions.
TinyPortal © 2005-2018