I've come across the word 'intrinsic type' in fortran which I've never heard before:
Fortran has five intrinsic data types: integer, real, complex, logical, and character.
Is intrinsic the same thing as "primitive", or is there a slight difference in meaning? What is the opposite of an intrinsic type (I would imagine something like a date or decimal): what would that be called?
Fortran Standard defines intrinsic (generally, not only for type) as:
1.3.93
intrinsic
type, procedure, module, assignment, operator, or input/output operation defined in this part of ISO/IEC 153917 and accessible without further definition or specification, or a procedure or module provided by a processor but not defined in this part of ISO/IEC 1539.
Moreover, it defines intrinsic type as follow:
1.3.147.8
intrinsic type
type defined by this part of ISO/IEC 1539 that is always accessible.
So the main difference between an intrinsic type and a derived type is that you must import a library in order to use the last one. (I have previously made an example of a non-intrinsic using real(real64) from ISO_FORTRAN_ENV
library, but as francescalus pointed out in the comments, it is not the case.)
You may also want to check session 4.4 of the Standard, which specifically deals with intrinsic types in detail. The Fortran Standard copy I have is unofficial and not the latest one, but the most recent ones are compliant with the old ones as part of Fortran philosophy.
I have not find any match for primitive
in the Fortran Standard, so I believe this nomenclature is not used in Fortran. I've also checked C standard and could not really find anything official, but every definition I find for the term in other languages - for instance in Java - basically defines it as a type which comes with the language, i.e, intrinsic. :)
Perhaps the difference you are looking for is that although real
is an intrinsic type in Fortran, double precision
is not:
The type specifier for the real type uses the keyword REAL. The keyword DOUBLE PRECISION is an alternative specifier for one kind of real type. If the type keyword REAL is used without a kind type parameter, the real type with default real kind is specified and the kind value is KIND (0.0). The type specifier DOUBLE PRECISION specifies type real with double precision kind; the kind value is KIND (0.0D0). The decimal precision of the double precision real approximation method shall be greater than that of the default real method.
However, in other languages, types such as short
and long
may be understood as different primitives.