This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: ISO_VARYING_STRING


On 12/26/2010 01:48 PM, Tobias Burnus wrote:
Hi Jerry,

Jerry DeLisle wrote:
Has the above standard officially been approved?

Yes, cf. http://gcc.gnu.org/wiki/GFortranStandards That's ISO 1539-2:2000. That's an approved standard, it is still in "maintenance" by WG5. However, similarly to part 3 (conditional compilation), it might be withdrawn in the future.

Thus "ISO Fortran" still consists of three parts: "Fortran 2008" (= Part 1,
ISO/IEC 1539-1:2010), "ISO Varying Strings" (1539-2:2000) and "conditional
compilation (coco)" (1539-3:1998). All standards are still maintained - but as
written, there are plans to withdraw CoCo (as there is only a single
implementation) and possibly also ISO Varying Strings. However, no formal
procedure to do so has been started yet. Search for "SC22", "Part 3" and "Part
2" at http://www.nag.co.uk/sc22wg5/. For Part 3 (CoCo) a JTC 1 ballot for
withdrawal has been requested at the last SC22 plenary. For Part 2 not (yet).

Thus, Steve's answer at
http://software.intel.com/en-us/forums/showthread.php?t=78419 is misleading.

Are there any plans to implement an intrinsic module for this within gfortran?
I see there is a publicly available implementation, but I do not like the
licensing terms of that one.

Yes and no - I think Paul said something that we once got or were about to get the permission to include the Fortran implementation in gfortran. While I recall an email about that, I could not find it when I tried about two years ago. However, every user can use the Fortran implementations at http://www.nag.co.uk/sc22wg5/IS1539-2.html and http://www.fortran.com/iso_varying_string.f95

Note (cf. also Steve Lionel) that ISO varying strings have been kind of
obsoleted by Fortran 2003's deferred type parameters for CHARACTER (allocatable
string lengths), which make together with (re)allocate on assignment the
handling of strings in Fortran rather convenient - and without introducing the
clumsy workaround with having a special data type as Part 2 of ISO Fortran does.

Unfortunately, allocatable string lengths are not yet implemented in gfortran.
(There are still some issues with the way one represents them to the middle end
- Paul had a draft patch, but it did not completely work. Additionally,
(re)allocate on assignment is currently only implemented for arrays.)

I am sure gfortran will get to this with strings. Ifort does so now (12). It is convenient for sure. One of the most irritating things I see right now is trying to map a C string into a Fortran string. I have to have the C routine return the length of the string, then allocate the Fortran string to that length, then copy it in. I am wondering if we shouldn't implement a Fortran extension c_f_string, a function which when given a pointer to a C string, returns a Fortran string of that length (make it intrinsic)


interface
  function c_f_string (c_string)
    use iso_c_binding, only: c_ptr
    type(c_ptr)
    character(*) :: c_f_string
  end function
end interface

Even after allocation on assignment for character is implemented, the above would be useful. Does anyone have a better suggestion?

Jerry


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]