Quantcast
Channel: Intel® Software - Intel® Fortran Compiler for Linux* and macOS*
Viewing all articles
Browse latest Browse all 2746

TYPE IS guard for multiple kinds

$
0
0

Is it possible to write a TYPE IS guard for an unlimited polymorphic class, but that matches the type regardless of the kind (for intrinsic types only, naturally). For instance

CLASS(*), INTENT(IN) :: my_int

SELECT TYPE(my_int)
   TYPE IS(INTEGER(KIND=*))
      PRINT *,"This is an integer, but I don't know which kind!"
   CLASS DEFAULT
      PRINT *,"Nope, not an integer"
END SELECT

Does Fortran 2008 allow any trick to treat this case or do I have to actually copy and paste the same statement block for every single kind of integer?

Thanks in advance!


Viewing all articles
Browse latest Browse all 2746

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>