Re: gfortran diagnostics and so on



"Richard Maine" <nospam@xxxxxxxxxxxxx> wrote in message news:1i7zirl.hdl6kepl696lN%nospam@xxxxxxxxxxxxxxxx
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.

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

.



Relevant Pages

  • Re: gfortran diagnostics and so on
    ... Well, in f0003, backslash is part of the standard Fortran character set. ... 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. ... There already are extensions in some compilers that allow you to specify C-style escapes without mucking up regular Fortran character literals. ...
    (comp.lang.fortran)
  • Re: gfortran diagnostics and so on
    ... Well, in f0003, backslash is part of the standard Fortran character set. ... 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. ... There already are extensions in some compilers that allow you to specify C-style escapes without mucking up regular Fortran character literals. ...
    (comp.lang.fortran)
  • Re: Unrecognized escape sequences in string literals
    ... character without knowing the context, ... '\n' maps to the string chr. ... In both cases the backslash in the literal have the same meaning: ... escape every backslash, ...
    (comp.lang.python)
  • Re: New Line Constant Error!
    ... > make a special character that you can't type into your program. ... > tries to combine the backslash with the following character to create ... which the compiler reads as a special sequence that folds down into ... because the sequence backslash-en is ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Eigenartiges Verhalten von "String[] java.lang.String.split(String regex)" - Falscher Split
    ... "It is an error to use a backslash prior to any alphabetic character ... Alle anderen Backslashes sind nicht erlaubt und ... musst du das mit ...
    (de.comp.lang.java)