For Programmers: Free Programming Magazines  


Home > Archive > Fortran > November 2007 > Backslashes (was: gfortran diagnostics and so on)









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Backslashes (was: gfortran diagnostics and so on)
Thomas Koenig

2007-11-23, 7:09 pm

On 2007-11-22, Richard Maine <nospam@see.signature> wrote:

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


gfortran currently follows g77 in this respect. The g77 rationale
can be found at

http://gcc.gnu.org/onlinedocs/gcc-3...sh-in-Constants

(basically, compatibility with existing f77 compilers at the time).

How do other existing compilers treat backslashes? It would be
interesting to know if g77/gfortran are alone in this.

mike.prager@noaa.gov

2007-11-26, 7:17 pm

On Nov 23, 5:00 pm, Thomas Koenig <tkoe...@netcologne.de> wrote:
> On 2007-11-22, Richard Maine <nos...@see.signature> wrote:
>
>
> gfortran currently follows g77 in this respect. The g77 rationale
> can be found at
>
> http://gcc.gnu.org/onlinedocs/gcc-3...Constants.ht...
>
> (basically, compatibility with existing f77 compilers at the time).
>
> How do other existing compilers treat backslashes? It would be
> interesting to know if g77/gfortran are alone in this.


I tried it on Windows XP with Lahey (LF95 7.10.02), g95
(0.91!), and Intel fortran (ifort 10.0.026). They all accept the
backslash as a character in a quoted string, and when asked to
print it, they print it. No special setting were used.

I would far prefer that the default of *any* compiler be not to apply
any special translation to visible characters the user has typed.
Clearly OSes have different line end characters, and it is reasonable
for compilers to respect that. It is not reasonable for compilers to
impose a peculiar translation of a visible character, just because one
operating system happens to do that.

The above of course is a matter of taste. What goes beyond taste
is the F2003 standard. Given that the backslash is part of the
character set, it arguably would be a defect for a compiler by
default to mess with the user's input of printable characters.

--
Mike Prager, NOAA, Beaufort, NC
* Opinions expressed are personal and not represented otherwise.
* Any use of tradenames does not constitute a NOAA endorsement.
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com