Re: backslash-issues
- From: Bart Vandewoestyne <MyFirstName.MyLastName@xxxxxxxxxx>
- Date: Thu, 30 Jun 2005 15:33:32 +0000 (UTC)
On 2005-06-30, Arjen Markus <arjen.markus@xxxxxxxxxx> wrote:
>
>> there was another thread about this issue, this seems quite nice to me:
>>
>> CHARACTER(LEN=1), PARAMETER :: backslash='\\'
>
> The problem with that approach is that the backslash may not be a
> valid character for the compiler (it is not part of the language's
> character set).
True, and it has even more problems... it doesn't work at all under F.
If i try to compile the following with my F-compiler:
character(len=1), parameter :: backslash = "\\"
I get:
Error: test_backslash.f95, line 13: Character parameter BACKSLASH must
have declared length *
So i change it to:
character(len=*), parameter :: backslash = "\\"
but then the whole 'trick' does not work anymore of course...
And what Arjen said is right, the backslash character does not always
belong to the character set of the processor/compiler... for example
when I compile using my ifc compiler i get:
character(len=1), parameter :: backslash = '\\'
^
Warning 18 at (13:test_backslash.f95) : \ used as an escape character is an extension to standard Fortran 95
This leads me to the conclusion that if you also want to be F-compliant, then
this is the best solution so far (until maybe someone comes up with a better
one :-)
character(len=*), parameter :: backslash = char(92)
With the only remark that you have to hope that your Fortran compiler uses the
ASCII collating sequence for it's character numbering.
Regards,
Bart
--
"Share what you know. Learn what you don't."
.
- Follow-Ups:
- Re: backslash-issues
- From: bv
- Re: backslash-issues
- From: Joost
- Re: backslash-issues
- From: Richard E Maine
- Re: backslash-issues
- References:
- backslash-issues
- From: Bart Vandewoestyne
- Re: backslash-issues
- From: Bart Vandewoestyne
- Re: backslash-issues
- From: Joost
- Re: backslash-issues
- From: Arjen Markus
- backslash-issues
- Prev by Date: Re: backslash-issues
- Next by Date: HELP ME - HOW THIS ERROR?
- Previous by thread: Re: backslash-issues
- Next by thread: Re: backslash-issues
- Index(es):
Relevant Pages
|
|