Re: remark on defining size of basic types

Liste des GroupesRevenir à l c 
Sujet : Re: remark on defining size of basic types
De : janis_papanagnou+ng (at) *nospam* hotmail.com (Janis Papanagnou)
Groupes : comp.lang.c
Date : 05. Apr 2024, 08:30:16
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <uuo5pp$17d43$1@dont-email.me>
References : 1 2 3 4 5 6 7 8 9
User-Agent : Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0
On 05.04.2024 02:46, Lawrence D'Oliveiro wrote:
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, [...]

For the first question I thought you were referring to old Fortran
versions - I certainly was referring to that syntax, and I see that
my memories were correct -, where you can find types like INTEGER*1,
INTEGER*2, INTEGER*5, INTEGER*8 (see e.g. [*], Table 11 on page 17).

[*] https://docs.nvidia.com/hpc-sdk/pgi-compilers/17.9/pdf/pgi17fortref.pdf

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.

Yes, but I read that 'KIND' specification as a readable variant
of the old syntax where you can also just select between a couple
standard sizes for integers (like SHORT, LONG, etc.).

(But I'm not much interested in Fortran, and we're off-topic.)

Janis


Date Sujet#  Auteur
4 Apr 24 * remark on defining size of basic types21fir
4 Apr 24 `* Re: remark on defining size of basic types20Lawrence D'Oliveiro
4 Apr 24  `* Re: remark on defining size of basic types19fir
4 Apr 24   `* Re: remark on defining size of basic types18Lawrence D'Oliveiro
4 Apr 24    `* Re: remark on defining size of basic types17fir
4 Apr 24     `* Re: remark on defining size of basic types16Janis Papanagnou
4 Apr 24      +* Re: remark on defining size of basic types7James Kuyper
4 Apr 24      i`* Re: remark on defining size of basic types6Michael S
4 Apr 24      i +- Re: remark on defining size of basic types1Keith Thompson
5 Apr 24      i +* Re: remark on defining size of basic types2Janis Papanagnou
5 Apr 24      i i`- Re: remark on defining size of basic types1James Kuyper
5 Apr 24      i `* Re: remark on defining size of basic types2James Kuyper
5 Apr 24      i  `- Re: remark on defining size of basic types1Keith Thompson
5 Apr 24      `* Re: remark on defining size of basic types8Lawrence D'Oliveiro
5 Apr 24       +* Re: remark on defining size of basic types6Janis Papanagnou
5 Apr 24       i`* Re: remark on defining size of basic types5Lawrence D'Oliveiro
5 Apr 24       i `* Re: remark on defining size of basic types4Janis Papanagnou
5 Apr 24       i  `* Re: remark on defining size of basic types3Lawrence D'Oliveiro
5 Apr 24       i   `* Re: remark on defining size of basic types2Michael S
5 Apr 24       i    `- Re: remark on defining size of basic types1Keith Thompson
5 Apr 24       `- Re: remark on defining size of basic types1Kenny McCormack

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal