This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/37224] New: Request for C string literal syntax
- From: "jkrahn at nc dot rr dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 24 Aug 2008 18:48:37 -0000
- Subject: [Bug fortran/37224] New: Request for C string literal syntax
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Intel Fortran has a notation to specify C string literals by appending the
letter C at the end of the string. See here for an example:
http://www.intel.com/software/products/compilers/docs/flin/main_for/mergedProjects/lref_for/source_files/pgcchcs.htm
It would be nice to have this, or something similar, in gfortran.
With Intel Fortran, it causes the string to interpret backslash sequences as in
C, and append a NUL character. I suggested to Intel the idea of implementing a
.C. unary string operator to do the same thing (I had seen it suggested on
c.l.f.), with the idea of trying to fit extensions into vendor intrinsic
modules instead of the traditional non-standard syntax approach. They said it
would be less standard-conforming, maybe because defined-unary operators cannot
be used in initialization expressions. They also stated that the C-suffix
approach was a well-establish extension, although neither gfortran nor Sun have
it.
I am requesting that gfortran support Intel's C-string notation to improve the
portability of C-interop code, if you think the extension is reasonable. It
would be nice for Fortran compiler developers to agree on some other common
convention, no matter what it is. One negative aspect of Intel's notation is
that it would be good to support C escape sequences independent of the NUL
terminator.
FYI: I also suggested that they look into gfortran's work on implementing new
character kinds such as UTF-8. That will also be very useful for reliable C
interop.
--
Summary: Request for C string literal syntax
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: jkrahn at nc dot rr dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37224