Liste des Groupes | Revenir à cl c |
On Fri, 5 Apr 2024 02:25:22 +0200, Janis Papanagnou wrote:
On 05.04.2024 01:38, Lawrence D'Oliveiro wrote:
>On Thu, 4 Apr 2024 15:15:26 +0200, Janis Papanagnou wrote:>
>Sometimes it's useful to have an unbounded or parameterized integral>
data type available ...
Interestingly, Fortran (of all things) has that.
Was that the e.g. '*8' syntax? - Did it allow arbitrary lengths?
No, and no. Since Fortran 2003, [...]
you can parameterize a custom type
definition with integer values. These can be used to specify the sizes of
arrays, or they can be used as codes for the different (implementation-
defined) precisions of integer and real types. An example from the
language spec:
TYPE :: t1(k1,k2)
INTEGER, KIND :: k1,k2
REAL(k1) a(k2)
END TYPE
This defines a custom type “t1”, which is an array of reals; the first
parameter determines the precision of the reals, and the second one
specifies the length of the array.
There are various query mechanisms (built-in functions, standard modules)
to determine the valid values of the number-precision codes.
Les messages affichés proviennent d'usenet.