1

Internet has a lot of open source code written in the Fortran programming language. Sometimes the 'intrinsic' keyword can be met in a code. I saw that the 'intrinsic' keyword can be used with 'use' keyword. Here is an example:

    program main
        use, intrinsic :: iso_fortran_env, only : int8, int16, int32, int64
        implicit none
        !
        ! Some code
        !
    end program main

I would like to understand better and more correctly the purpose of the application of this keyword in this context.

francescalus
  • 30,576
  • 16
  • 61
  • 96
SFriendly
  • 119
  • 3
  • Asking to locate or recommend an external resource is off-topic. You can use a web search engine to search about web tutorials. There is nothing overly complicated about `intrinsic`. You add it to declarations involving intrinsic entities if necessary or convenient. Some examples where it might be necessary can be found here on Stack Overflow by the mentioned web search engines. Most people have the opposite problem though, where they need to use the `external` keyword to avoid the intrinsics. – Vladimir F Героям слава Oct 20 '22 at 12:27
  • 2
    The authoritative resource about the rules is the standard document, accessible through the [tag:fortran] tag description page. Some textbooks also mentioned how it is used. One example of the local Qs/As is https://stackoverflow.com/questions/35003926/compiling-with-gfortran-undefined-reference-to-iargc?noredirect=1&lq=1 . Another is https://stackoverflow.com/questions/19257056/intrinsic-function-as-a-function-argument but we must add a disclaimer that passing a specific function of a generic function like `sin` is no longer allowed in F2018. – Vladimir F Героям слава Oct 20 '22 at 12:31
  • Another possibility for you is to formulate a specific question that can be asked here. But do not just ask for an internet description, please. – Vladimir F Героям слава Oct 20 '22 at 12:37
  • The only rule for using the "intrinsic" keyword is to tell the compiler to apply the "intrinsic" attribute. I suspect you care much more about the intrinsic attribute than the low level considerations of lexing and syntax parsing. Please clarify – francescalus Oct 20 '22 at 13:17
  • 1
    This [other question](https://stackoverflow.com/q/43522352/3157076) asks about module natures, and "intrinsic" here refers to such a module nature. – francescalus Oct 20 '22 at 14:31
  • @francescalus I recommend voting to close as a duplicate of this one. I would have voted myself, but cannot vote anymore due to a previous vote, which is now already expired. TBH, I think that less than 5 days of expiration is way too little in low-traffic tags. – Vladimir F Героям слава Oct 25 '22 at 08:01
  • 1
    @VladimirFГероямслава, thanks for noticing this has been re-opened. I also cannot vote to close again. (Let's say that I'm disappointed that users with no experience of [tag:fortran] voted to reopen an obvious duplicate which had been commented.) – francescalus Oct 25 '22 at 08:09
  • Oh, I did not realized it was actually re-opened. @Timmy why did you re-open an obvious duplicate? – Vladimir F Героям слава Oct 25 '22 at 13:00

0 Answers0