# FITS IO in Fortran

**URL:** <https://fortran-lang.discourse.group/t/fits-io-in-fortran/11006>\
**Category:** Uncategorized\
**Created:** [July 20, 2026, 8:17am UTC](https://fortran-lang.discourse.group/t/fits-io-in-fortran/11006 "2026-07-20T08:17:57Z")\
**Posts on this page:** 1\
**Showing post:** 17

<div class="post-metadata">

**Author:** ![RonShepard](https://avatars.discourse-cdn.com/v4/letter/r/a3d4f5/32.png) [@RonShepard](https://fortran-lang.discourse.group/u/RonShepard)\
**Post date:** [July 24, 2026, 2:38am UTC](https://fortran-lang.discourse.group/t/fits-io-in-fortran/11006/17 "2026-07-24T02:38:53Z")

</div>

> [@urbanjost](#):
>
> Does anyone else feel something like the “flatten” procedure should be available as a standard fortran feature?

It is a double edged sword. The type-kind-rank (TKR) argument matching catches many programmer errors, so relaxing that TKR matching would mean that those types of errors could not be detected at compile time. That is why many legacy codes with explicit interfaces have this error to begin with.

I think we talked about this a little in relation to this thread. [Spacing of the results of Fortran intrinsic random\_number - #36 by RonShepard](https://fortran-lang.discourse.group/t/spacing-of-the-results-of-fortran-intrinsic-random-number/10884/36) The “solution” I ended up adopting there was to use assumed rank argument association, which then requires `select rank` blocks internally. If there is only one such argument, that isn’t so bad, but if there are many such arguments, and all possible rank matching is required for each of them, then the complexity can grow in an exponential way.

There is a special case that is easy to work around. If the actual argument is scalar `x`, and the dummy argument is `intent(in) :: x(:)`, then you can change the call statement actual argument to `[x]`. This rank 1 expression matches the TKR dummy argument. But this doesn’t work with other intent, so it is not really a general solution.

---

_[View the full topic](https://fortran-lang.discourse.group/t/fits-io-in-fortran/11006)._
