# Does gfortran support format like \<n\>g15.7 as Intel Fortran does?

**URL:** <https://fortran-lang.discourse.group/t/does-gfortran-support-format-like-n-g15-7-as-intel-fortran-does/2894>\
**Category:** Uncategorized\
**Created:** [March 4, 2022, 7:07am UTC](https://fortran-lang.discourse.group/t/does-gfortran-support-format-like-n-g15-7-as-intel-fortran-does/2894 "2022-03-04T07:07:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![CRquantum](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/crquantum/32/730_2.png) [@CRquantum](https://fortran-lang.discourse.group/u/CRquantum)\
**Post date:** [March 4, 2022, 7:07am UTC](https://fortran-lang.discourse.group/t/does-gfortran-support-format-like-n-g15-7-as-intel-fortran-does/2894/1 "2022-03-04T07:07:21Z")

</div>

Dear all,  
A simple code below,

```auto
  integer :: n
  real, allocatable :: x(:)
  n=5
  allocate(x(n))
  x=100.0
  write(6,'( <n>(g15.7,1x) )') x
  end

```

The output is

```auto
100.0000 100.0000 100.0000 100.0000 100.0000

```

Note that `<n>` in the format is support in Intel Fortran, which is very convenient in my opinion. So the format can be easily controlled by the the variable `n`.

I wonder does gfortran support such a thing or have something similar?

Thank you very much in advance!

---

<div class="post-metadata">

**Author:** ![Arjen](https://avatars.discourse-cdn.com/v4/letter/a/b9bd4f/32.png) [@Arjen](https://fortran-lang.discourse.group/u/Arjen)\
**Post date:** [March 4, 2022, 8:34am UTC](https://fortran-lang.discourse.group/t/does-gfortran-support-format-like-n-g15-7-as-intel-fortran-does/2894/2 "2022-03-04T08:34:40Z")

</div>

This is an extension typical for Intel Fortran, so I’d say no. Note that a standard feature is the use of an “unlimited” format specifier:

```auto
write(6,'(*(g15.7,1x))') x

```

which, in this case, will achieve the very same thing. (Even without the “1x” you need to “group” the format specifier - ‘(\*(g15.7))’)

---

<div class="post-metadata">

**Author:** ![Jcollins](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/jcollins/32/540_2.png) [@Jcollins](https://fortran-lang.discourse.group/u/Jcollins)\
**Post date:** [March 4, 2022, 9:17am UTC](https://fortran-lang.discourse.group/t/does-gfortran-support-format-like-n-g15-7-as-intel-fortran-does/2894/3 "2022-03-04T09:17:12Z")

</div>

This is an Intel extension inherited from VMS. The easy way to remove the constructs is to write them to a string and then to embed the string in the format. There was a post describing this in comp.lang.fortran a long time ago which I haven’t managed to find. If you have a lot of them, fpt will make this change automatically - please see [http://simconglobal.com/fpt\_ref\_remove\_embedded\_expressions\_from\_formats.html](http://simconglobal.com/fpt_ref_remove_embedded_expressions_from_formats.html)  
John.
