From https://gcc.gnu.org/gcc-16/changes.html :
- Coarrays using native shared memory mulithreading on single
node machines and handling Fortran 2018's TEAM feature.
- Fortran 2003: Parameterized Derived Types support is
improved. Handling of LEN parameters works but still requires
a future change of representation (see PR82649).
- Fortran 2018: Support the extensions to the IMPORT statement,
the REDUCE intrinsic and the new GENERIC statement.
- The Fortran 2023 additions to the trigonometric functions are
now supported (such as the sinpi intrinsic).
- Fortran 2023: The split intrinsic subroutine is now supported
and c_f_pointer now accepts an optional lower bound as a argument.
- The -fexternal-blas64 option has been added to call external BLAS
routines with 64-bit integer arguments for MATMUL. This option
is only valid for 64-bit systems and when -ffrontend-optimize is
in effect.
... gfortran 16.1 also supports the new F2023 conditional expression
such as
x = (y > 0 ? log(y) : some_error_fcn(x))
On Fri, 1 May 2026 19:31:21 -0000 (UTC), Steven G. Kargl wrote:
... gfortran 16.1 also supports the new F2023 conditional expression
such as
x = (y > 0 ? log(y) : some_error_fcn(x))
Doing it exactly the same way as C (which introduced this syntax) and
just about every other language which adopted the feature afterwards
... except Python.
By the way, do you need the parentheses around the expression?
On Fri, 1 May 2026 22:34:42 -0000 (UTC), Lawrence D’Oliveiro wrote:
Doing it exactly the same way as C (which introduced this syntax)
and just about every other language which adopted the feature
afterwards ... except Python.
1) Why re-invent the wheel in language design?
On Fri, 1 May 2026 19:31:21 -0000 (UTC), Steven G. Kargl wrote:
... gfortran 16.1 also supports the new F2023 conditional expression
such as
x = (y > 0 ? log(y) : some_error_fcn(x))
Doing it exactly the same way as C (which introduced this syntax) and
just about every other language which adopted the feature afterwards
... except Python.
By the way, do you need the parentheses around the expression?
Lawrence D’Oliveiro wrote:
On Fri, 1 May 2026 19:31:21 -0000 (UTC), Steven G. Kargl wrote:
... gfortran 16.1 also supports the new F2023 conditional expression
such as
x = (y > 0 ? log(y) : some_error_fcn(x))
Doing it exactly the same way as C (which introduced this syntax) and
just about every other language which adopted the feature afterwards
... except Python.
By the way, do you need the parentheses around the expression?
I first encountered that syntax in Algol68, this was around 1976.
There it would have been
x := (y > 0 | log (y) | some_error_fcn (x)) ;
- I can't remember if underscore is a permitted character in a variable
or a function name.
- The semicolon at the end is only required if another statement follows.
The first edition of my Algol68 manual was published in 1972 so I think
we can assume C got it from Algol68 (or they both got it from some other language).
(Yes, a function with a side-effct is evil).
if (a > b .and. c > foo(a)) then
Here, the Fortran standard does not specify the order of evaluation
for a > b and c > foo(a). In addition, both operands of .and. will
be evaluated.
On Sat, 2 May 2026 18:49:39 -0000 (UTC), Steven G. Kargl wrote:
if (a > b .and. c > foo(a)) then
Here, the Fortran standard does not specify the order of evaluation
for a > b and c > foo(a). In addition, both operands of .and. will
be evaluated.
Somehow I don’t think they will. Otherwise GNU Fortran would not do short-circuit evaluation when any significant level of optimization is
turned on.
On Sat, 2 May 2026 18:49:39 -0000 (UTC), Steven G. Kargl wrote:
(Yes, a function with a side-effct is evil).
Not necessarily. There are these things called “memo-functions”, which cache computed results so they can save redoing the computation if
they are given the same set of args later.
Updating the cache is a side-effect, which speeds up execution. Is
that “evil”? I don’t think so.
On Sat, 2 May 2026 23:17:51 -0000 (UTC), Lawrence D’Oliveiro wrote:
On Sat, 2 May 2026 18:49:39 -0000 (UTC), Steven G. Kargl wrote:
(Yes, a function with a side-effct is evil).
Not necessarily. There are these things called “memo-functions”,
which cache computed results so they can save redoing the
computation if they are given the same set of args later.
Updating the cache is a side-effect, which speeds up execution. Is
that “evil”? I don’t think so.
A better example is a PRNG function.
On Sat, 2 May 2026 23:19:50 -0000 (UTC), Lawrence D’Oliveiro wrote:
On Sat, 2 May 2026 18:49:39 -0000 (UTC), Steven G. Kargl wrote:
if (a > b .and. c > foo(a)) then
Here, the Fortran standard does not specify the order of
evaluation for a > b and c > foo(a). In addition, both operands of
.and. will be evaluated.
Somehow I don’t think they will. Otherwise GNU Fortran would not do
short-circuit evaluation when any significant level of optimization
is turned on.
Yeah, gfortran has made a processor-dependent choice to evaluate
expressions left-to-right. That's not required by the Fortran
standard *except for conditional expressions*.
| Sysop: | DaiTengu |
|---|---|
| Location: | Appleton, WI |
| Users: | 1,116 |
| Nodes: | 10 (0 / 10) |
| Uptime: | 86:53:45 |
| Calls: | 14,305 |
| Files: | 186,338 |
| D/L today: |
1,016 files (320M bytes) |
| Messages: | 2,525,511 |