Re: gfortran diagnostics and so on



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


.



Relevant Pages