Recent

Author Topic: Compiler intrinsic functions  (Read 1435 times)

simone

  • Sr. Member
  • ****
  • Posts: 486
Compiler intrinsic functions
« 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.
« Last Edit: July 16, 2022, 07:17:14 pm by simone »
Microsoft Windows 10 64 bit - Lazarus 2.2.4

440bx

  • Hero Member
  • *****
  • Posts: 3164
Re: Compiler intrinsic functions
« Reply #1 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.
FPC v3.0.4 and Lazarus 1.8.2 on Windows 7 SP1 64bit.

simone

  • Sr. Member
  • ****
  • Posts: 486
Re: Compiler intrinsic functions
« Reply #2 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.
« Last Edit: July 16, 2022, 08:38:32 pm by simone »
Microsoft Windows 10 64 bit - Lazarus 2.2.4

Bi0T1N

  • Jr. Member
  • **
  • Posts: 80
Re: Compiler intrinsic functions
« Reply #3 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 it should be visible the next day here :)

simone

  • Sr. Member
  • ****
  • Posts: 486
Re: Compiler intrinsic functions
« Reply #4 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.
« Last Edit: July 16, 2022, 09:14:52 pm by simone »
Microsoft Windows 10 64 bit - Lazarus 2.2.4

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 10402
  • FPC developer.
Re: Compiler intrinsic functions
« Reply #5 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.

simone

  • Sr. Member
  • ****
  • Posts: 486
Re: Compiler intrinsic functions
« Reply #6 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.
Microsoft Windows 10 64 bit - Lazarus 2.2.4

PascalDragon

  • Hero Member
  • *****
  • Posts: 4765
  • Compiler Developer
Re: Compiler intrinsic functions
« Reply #7 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.

simone

  • Sr. Member
  • ****
  • Posts: 486
Re: Compiler intrinsic functions
« Reply #8 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.
Microsoft Windows 10 64 bit - Lazarus 2.2.4

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 10402
  • FPC developer.
Re: Compiler intrinsic functions
« Reply #9 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.

simone

  • Sr. Member
  • ****
  • Posts: 486
Re: Compiler intrinsic functions
« Reply #10 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.
Microsoft Windows 10 64 bit - Lazarus 2.2.4

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 10402
  • FPC developer.
Re: Compiler intrinsic functions
« Reply #11 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.

simone

  • Sr. Member
  • ****
  • Posts: 486
Re: Compiler intrinsic functions
« Reply #12 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.
« Last Edit: July 17, 2022, 06:42:17 pm by simone »
Microsoft Windows 10 64 bit - Lazarus 2.2.4

Thaddy

  • Hero Member
  • *****
  • Posts: 12209
Re: Compiler intrinsic functions
« Reply #13 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.
« Last Edit: July 17, 2022, 09:32:59 pm by Thaddy »
Manuals, manuals, manuals first.
You have incompetence and sheer incompetence.

simone

  • Sr. Member
  • ****
  • Posts: 486
Re: Compiler intrinsic functions
« Reply #14 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!
Microsoft Windows 10 64 bit - Lazarus 2.2.4

 

TinyPortal © 2005-2018