This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/37224] Request for C string literal syntax
- From: "burnus at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 24 Aug 2008 20:26:03 -0000
- Subject: [Bug fortran/37224] Request for C string literal syntax
- References: <bug-37224-14229@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #2 from burnus at gcc dot gnu dot org 2008-08-24 20:26 -------
> FYI: I also suggested that they look into gfortran's work on implementing new
> character kinds such as UTF-8.
That part is defined in the Fortran 2003 standard (optional) and the
almost-ISO-approved Fortran 2008 (mandatory) thus I expect that Intel will get
it sooner or later as well.
Regarding the "..."C syntax: I don't quite see why using -fbackslash is not
enough plus for zero terminating a string:
character, parameter :: NUL = achar(0)
then one can use:
str = "A C-like terminated string"//NUL
which should work with all Fortran compilers. And if one wants to use C escape
sequences, one can use the -fbackslash option in gfortran and the -assume bscc
option of ifort.
Or one uses instead the predefined values of Fortran 2003 (though their names
are a bit long):
"This is followed by a
tab"//C_HORIZONTAL_TAB//"*bing*"//C_ALERT//C_NEW_LINE//C_NULL_CHAR
That should also work with all (C-binding supporting) compilers. One could also
define shorter names, e.g. C_TAB = C_HORIZONTAL_TAB, C_NL = C_NEW_LINE etc.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37224