Sujet : Re: Cray style vectors
De : already5chosen (at) *nospam* yahoo.com (Michael S)
Groupes : comp.archDate : 11. Mar 2024, 19:38:44
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <20240311203844.000071ad@yahoo.com>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
User-Agent : Claws Mail 3.19.1 (GTK+ 2.24.33; x86_64-w64-mingw32)
On Mon, 11 Mar 2024 18:19:19 -0000 (UTC)
Thomas Koenig <
tkoenig@netcologne.de> wrote:
On 2024-03-11, Michael S <already5chosen@yahoo.com> wrote:
On Mon, 11 Mar 2024 18:01:31 -0000 (UTC)
Thomas Koenig <tkoenig@netcologne.de> wrote:
Thomas Koenig <tkoenig@netcologne.de> schrieb:
David Brown <david.brown@hesbynett.no> schrieb:
On 20/02/2024 07:31, Thomas Koenig wrote:
Even further on the side: I wrote up a proposal for finally
introducing a wrapping UNSIGNED type to Fortran, which
hopefully will be considered in the next J3 meeting, it can be
found at https://j3-fortran.org/doc/year/24/24-102.txt .
In this proposal, I intended to forbid UNSIGNED variables in
DO loops, especially for this sort of reason.
(Testing a new news server, my old one was decomissioned...)
I was quite delighted, but also a little bit surprised that the
proposal (somewhat modified) actually passed.
Now, what's left is the people who do not want modular arithmetic,
for a reason that I am unable to fathom. I guess they don't like
multiplicative hashes...
>
What do they like?
To declare unsigned overflow UB? Or implementation defined? Or
trapping?
Illegal, hence an implementation would be free to trap or start
World War III (with a bit of an expectation that compilers would
trap when supplied with the right options).
So, speaking in C Standard language, UB.
My expecation is different: It would then be treated like signed
overflow, which is also illegal in Fortran. So, everybody will
implement it as if it were modular 2^n anyway, plus start optimizing
on the assumption that overflow cannot happen.
>
Yes, I'd expect the same.
And, since in Fortran, arrays can start at arbitrary lower bounds
(and array can have a lower bound of -42 and an upper bound of -21,
for example), the use of unsigned integers for array indices is
somewhat less than in programming languages such as C or (I believe)
Rust where they always start at zero.
As discussed here just recently, there are good reason to avoid
'unsigned' array indices in performance-oriented programs running under
IL32P64 or I32LP64 C environments. Everything else is preferable -
int, ptrdiff_t, size_t. Now, opinions on which of the 3 is most
preferable, tend to vary.
What is the size of Fortran's default UNSIGNED ?