Re: gfortran diagnostics and so on
- From: "jamesgiles@xxxxxxx" <jamesgiles@xxxxxxx>
- Date: Fri, 23 Nov 2007 10:19:23 -0800 (PST)
On Nov 23, 10:42 am, "Craig Dedo" <cd...@xxxxxxxxx> wrote:
There already are extensions in some compilers that allow you to specify
C-style escapes without mucking up regular Fortran character literals. See my
comments above. One of them is the Compaq Visual Fortran (CVF) extension that
designates C-style character literals as string contstants followed immediately
by the letter C. Example:
"Character literal \n without embedded new line."
"Character literal \n with embedded new line."C
I believe some other compilers use the same notation or some similar method.
These all suffer from a weakness that's shared with
processing the escapes by default: the method is only
applicable to literals. A better solution would be
to have a prefix operator that processes escapes.
"Character literal \n without embedded new line."
.c. "Character result \n with embedded new line."
This has the added bonus of moving the indication to
the left so it's more easily visible. Since it's an
operator you can apply it to string variables, expressions
and so on. So you can write:
.c. ("abc" // '\' // "n" // mystring)
If that's your taste. You could write a different
operator to apply other escapes that some people find
preferable:
.e. "abc ^m^j" // mystring
String literals should be just that: literals. Their
value and their appearance should be one-to-one.
--
J. Giles
"I conclude that there are two ways of constructing a software
design: One way is to make it so simple that there are obviously
no deficiencies and the other way is to make it so complicated
that there are no obvious deficiencies." -- C. A. R. Hoare
.
- Follow-Ups:
- C String Prefix Operator Idea (Was: gfortran diagnostics and so on)
- From: Craig Dedo
- Re: gfortran diagnostics and so on
- From: Gary Scott
- Re: gfortran diagnostics and so on
- From: Dan Nagle
- C String Prefix Operator Idea (Was: gfortran diagnostics and so on)
- References:
- gfortran diagnostics and so on
- From: James Van Buskirk
- Re: gfortran diagnostics and so on
- From: Tobias Burnus
- Re: gfortran diagnostics and so on
- From: Richard Maine
- Re: gfortran diagnostics and so on
- From: Craig Dedo
- Re: gfortran diagnostics and so on
- From: Gary Scott
- Re: gfortran diagnostics and so on
- From: Craig Dedo
- gfortran diagnostics and so on
- Prev by Date: Re: gfortran diagnostics and so on
- Next by Date: Re: gfortran diagnostics and so on
- Previous by thread: Re: gfortran diagnostics and so on
- Next by thread: Re: gfortran diagnostics and so on
- Index(es):
Relevant Pages
|
|