This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC 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]

[Bug fortran/37224] Request for C string literal syntax



------- 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


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