Re: gfortran diagnostics and so on
- From: "Craig Dedo" <cdedo@xxxxxxxxx>
- Date: Fri, 23 Nov 2007 11:42:59 -0600
"Gary Scott" <garylscott@xxxxxxxxxxxxx> wrote in message news:g0E1j.19302$4V6.9450@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Craig Dedo wrote:"Richard Maine" <nospam@xxxxxxxxxxxxx> wrote in message news:1i7zirl.hdl6kepl696lN%nospam@xxxxxxxxxxxxxxxxHow about something unique in the way the string is quoted to cause it to be interpreted differently. Normal quotes (double or single/apostrophe) mean literal interpretation. Use some other quoting scheme to indicate substitution. You could even add an additional procedure containing text string arguments to substitute.
Tobias Burnus <burnus@xxxxxxxx> wrote:
I don't know how to handle this best. Backslashes are difficult as
some people expect that "\" prints a backslash, others want to have
"\n" as new line -- and both want to have their choice as default.
With either choice, you have unhappy users. But I am open to
suggestions.
Well, in f0003, backslash is part of the standard Fortran character set.
So I'll find it awfully hard to accept as reasonable a default that
doesn't conform to the standard. But then I'm one of those who has
always thought that doing backslash processing on Fortan code was an
unreasonable default, so just consider me biased.
--
Richard Maine | Good judgement comes from experience;
email: last name at domain . net | experience comes from bad judgement.
domain: summertriangle | -- Mark Twain
I wholeheartedly agree with Richard. Because the backslash is part of the standard Fortran character set, the default behavior should be the printable character, **NOT** some kind of magic introductory character that transforms the interpretation of following character(s). Compiler defaults should always follow the Fortran standard, wherever applicable.
Just because C uses backslash as a magic introductory character does not mean that Fortran should follow that practice. Although some may disagree, I have always thought that part of the spirit of Fortran is that it is designed to make life easy for the application developer. What you write on the blackboard is what you write in the source code. Among other things, that means that printable characters are exactly that, no more and no less.
There are reasonable alternatives for programmers who want the C language behavior. The one I like best is to use one of the popular extensions to designate a particular literal string according to the C language.
If a programmer wants control characters in character strings, the programmer can always use the CHAR() or ACHAR() intrinsic functions. The programmer also can define a module that defines all of the control characters as named constants. I have done that and it works very well.
<snip>
Of course you can easily write something like this if you need it (i'm sure it exists in various forms already).
--
Gary Scott
mailto:garylscott@sbcglobal dot net
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.
It is my recommendation that gfortran and other Fortran compilers use this or a similar method to distinguish between regular character literals and those that have C-style semantics. That way, it is very easy for both the compiler and human readers to distinguish the two.
--
Craig Dedo
17130 W. Burleigh Place
P. O. Box 423
Brookfield, WI 53008-0423
Voice: (262) 783-5869
Fax: (262) 783-5928
Mobile: (414) 412-5869
E-mail: <cdedo@xxxxxxxxx> or <craig@xxxxxxxxxx>
.
- Follow-Ups:
- Re: gfortran diagnostics and so on
- From: Gary Scott
- Re: gfortran diagnostics and so on
- From: jamesgiles@xxxxxxx
- Re: 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
- 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
|