Re: backslash-issues
Bart Vandewoestyne wrote:
On 2005-06-29, Bart Vandewoestyne <MyFirstName.MyLastName@xxxxxxxxxx> wrote:
[...]
Now this is something that I've found strange... F being a language that
tries to force the programmer 'good' programming style, wouldn't it then
have made more sense to keep the ACHAR intrinsic instead of the CHAR
intrinsic? For as far as i understand, both intrinsics do the same but
CHAR is less portable then ACHAR because it does not depend by definiton
on the ASCII character table?
Walt, any comments?
This is a sticky area and we may have made the wrong design decision.
It says somewhere in the fine print that all F implementations must
use ASCII. With that, CHAR seemed more straightforward. Don't know
what will happen if/when the world shifts to something else.
Hmm... As i did not have my 'The F programming language' book at hand
yesterday when I posted this, i had to look things up on the Net. But
today I've found this in my book, page 136, section 8.5.1:
char(i) is of type character and length one. It returns the character
in position i in the ASCII collating sequence. The value of i must be
in the range 0 \leq i \leq 127.
So actually, where you can't be sure that you are using the ASCII
collating sequence if you interpret CHAR according to the Fortran95
standard, you *can* be sure you are using the ASCII collating sequence
if you're using F. So that would make this solution portable in F:
character(len=*), parameter :: backslash = char(92)
But unfortunately, if i compile this as being Fortran95, i still cannot
be sure I will get the right character, because the interpretation of
the 92 will depend on the processor's character set :-(
Still, when trying to write both F and Fortran95 compatible code, i
think the above suggestion is the best i can come up with. And all i
can do is hope that my Fortran95 processor will also use the ASCII
collating sequence.
Or does anybody else see another solution?
Regards,
Bart
--
Walt Brainerd +1-877-355-6640 (voice & fax)
The Fortran Company +1-520-760-1397 (outside USA)
6025 N. Wilmot Road walt@xxxxxxxxxxx
Tucson, AZ 85750 USA http://www.fortran.com
.
Relevant Pages
- Re: what does "serialization" mean?
... Sorry eddie, but you're dead wrong there as usual. ... >>How about ASCII character 0xB0, ... > Totalitarians and Fascists are often self-appointed language police. ... (comp.programming) - Re: what does "serialization" mean?
... > attempt to present myself as an authority on any and every topic I have ... >> survived and EBCDIC did not because ASCII properly sequenced letters. ... > How about ASCII character 0xB0, ... >> must assert negative facts, for all he knows is there is no knowledge ... (comp.programming) - Re: Cohens paper on byte order
... I think you're using "ASCII" in a notional sense. ... a good reason to teach the *opposite* convention, ... Computers should be as easy to understand as is possible _without_ ... arithmetic on character strings ... (sci.crypt) - Re: Reading a file.
... your program will interpret them as ASCII. ... Bruce.Eitman AT EuroTech DOT com ... buffer is character values, then in memory ASCII values are displayed. ... DWORD d = GetLastError; ... (microsoft.public.windowsce.app.development) - Re: Get ASCII values for PC arrow keys?
... those responsible for standards usually do attempt ... ASCII is a character set, ... ISO/IEC registry for character sets for them to receive identifying ... (alt.comp.lang.learn.c-cpp) |
|