View previous topic :: View next topic |
Author |
Message |
Albert
Joined: 20 Jun 2010 Posts: 11
|
Posted: Sun Jun 27, 2010 10:52 am Post subject: Error 72: Line contains the character '<HT>' |
|
|
Dear all,
subject: Error 72: Line contains the character '<HT>' which is not in the ISO standard default set
I have a small problem with the interpretation of the FTN95 Personal Edition
compiler of the <HT> character in comment
Source code:
============
program test
! this is a comment line with a <HT> character
end
Compilation:
============
ftn95 /c /all_warnings /errorlog /error_numbers /iso /stat problem_2.f90
Result:
=======
*** Error 72: Line contains the character '<HT>' which is not in the ISO
standard default set
0001) program test
COMMENT - 157: PROGRAM TEST does not have any executable statements
In my opinion a <HT> character is allowed in comments, see paragraph 3.1.5 of
the Fortran standard (ISO/IEC 1539-1:1997(E)).
Any comments ?
Best Regards,
Albert |
|
Back to top |
|
 |
IanLambley
Joined: 17 Dec 2006 Posts: 506 Location: Sunderland
|
Posted: Sun Jun 27, 2010 11:40 am Post subject: |
|
|
Try compiling with the following as command line options:
ftn95 /c /all_warnings /errorlog /error_numbers /iso /stat /ignore 72 problem_2.f90
and if you decide to put the "WINAPP" directive in the program, then also add:
Regards
Ian |
|
Back to top |
|
 |
Albert
Joined: 20 Jun 2010 Posts: 11
|
Posted: Sun Jun 27, 2010 11:58 am Post subject: |
|
|
Ian,
Thanks for the answer, this is a work around. The main problem is the fact that the <HT> is not accepted, in parts of, the FTN95 compiler. I think this is a bug in the compiler and should be fixed (maybe I should made this a bit more clearer, I wanted to see if my interpretation of the FTN standard was correct so requested for comments).
Regards,
Albert |
|
Back to top |
|
 |
IanLambley
Joined: 17 Dec 2006 Posts: 506 Location: Sunderland
|
Posted: Sun Jun 27, 2010 1:50 pm Post subject: |
|
|
Albert,
The standard states:
Section 3: Characters, lexical tokens, and source form
This section describes the Fortran character set and the various lexical tokens such as names and operators.
This section also describes the rules for the forms that Fortran programs may take.
3.1 Processor character set
The processor character set is processor dependent. The structure of a processor character set is:
(1) Control characters
(2) Graphic characters
(a) Letters (3.1.1)
(b) Digits (3.1.2)
(c) Underscore (3.1.3)
(d) Special characters (3.1.4)
(e) Other characters (3.1.5)
The letters, digits, underscore, and special characters make up the Fortran character set.
It would seem that the control characters are not in the FORTRAN character set, and <ht> is excluded from the FORTRAN character set as it is a control character.
The statement you refer to is:
3.1.5 Other characters
Additional characters may be representable in the processor, but may appear only in comments (3.3.1.1,
3.3.2.1), character constants (4.4.4), input/output records (9.1.1), and character string edit descriptors
(10.2.1).
There are two character groups, 1) Control - non printing and 2) Graphic characters. Only Graphic characters can be used, i.e. those with a hexadecimal value between 20h & FFh. The "Other character" definition is a graphic character sub-section and it is those that may additionally be used in comments. You would not expect very many of the control characters between 00h & 1Fh to be usable in a text editor and they are certainly not visible. <HT> is Control+I (or tab), but if you wanted for example Control+G it would ring a bell every time the line containing it was listed. Control+H would perform a backspace. These characters are just not visible. And the <HT> is the same and interpreted differently by different editors. If you actually need to use a control character, define it using the intrinsic function "CHAR".
You should probably set your editor to translate <HT> to spaces.
I think that you have to accept that the action of FTN95 is correct.
Regards
Ian |
|
Back to top |
|
 |
Albert
Joined: 20 Jun 2010 Posts: 11
|
Posted: Sun Jun 27, 2010 3:34 pm Post subject: |
|
|
Ian,
I don't agree with your conclusion. The standard, as you showed as well, explicitly gives the possibility for other characters. I therefore think an error is not in its place especially not in comments or character strings.
The argument you bring up with editors is in this discussion irrelevant (My personal opinion is that one should never used <HT> in code).
Regards,
Albert |
|
Back to top |
|
 |
IanLambley
Joined: 17 Dec 2006 Posts: 506 Location: Sunderland
|
Posted: Sun Jun 27, 2010 6:46 pm Post subject: |
|
|
Elbart
I agree that the possibility for using other characters is there, but <ht> is one of 32 characters from the ASCII character set which is specifically excluded from being described as a member of the "Other character" set. The "Other character" set is a sub-set of "Graphic characters". The "Control character" set is not part of the "Graphic character" set and therefore none of the "Control characters" can be considered to be usable as an "Other character". <ht> IS an "Control character" and is therefore excluded from use within the text of the program. This is an indisputable fact - try drawing a Venn diagram.
In strict ISO mode, it is an error to use the <ht> character anywhere.
With regard to editors, it is unfortunate that it is so easy to insert a <ht> and for it to remain, nevertheless, it is still a control character and that is why so many editors have a translation function to replace it with the appropriate number of spaces.
As your personal opinion is that <ht> should never be used, I fail to see what this is all about. Translate them out of your code, and never press the tab key again unless the translate function is turned on.
Ian |
|
Back to top |
|
 |
Albert
Joined: 20 Jun 2010 Posts: 11
|
Posted: Sun Jun 27, 2010 7:35 pm Post subject: |
|
|
Ian,
The fact of the subdivision in (1) control characters (of which <HT> is one) and (2) Graphic characters, I must have missed. According to the strict ISO definition it is indeed not allowed to have a <HT> in your code, comment or character string. I'm a bit amazed that the <HT> has been ruled out by the standard (but I'm happy about it).
My conclusion now is that it is not a bug in the compiler.
My opinion about the usage of <HT> is a response to your statement " And the <HT> is the same and interpreted differently by different editors." Unfortunately sometimes one gets some code in which other people used <HT> characters.
Regards,
Albert |
|
Back to top |
|
 |
JohnCampbell
Joined: 16 Feb 2006 Posts: 2615 Location: Sydney
|
Posted: Mon Jun 28, 2010 1:29 am Post subject: |
|
|
Albert,
How should the compiler interpret the <HT> character ?
Are you suggesting it should do something with it or just ignore it.
I think the error is because there is no defined response to this control character. There is certainly no standardised response to the tab in most editors/IDEs.
John |
|
Back to top |
|
 |
Albert
Joined: 20 Jun 2010 Posts: 11
|
Posted: Mon Jun 28, 2010 6:56 am Post subject: |
|
|
John,
I already wrote in a previous email that I see, from my discussion with Ian, that in the strict ISO sense it is not a compiler bug.
I would expect that <HT> is seen just as a "blank" character and would be ignored by the compiler in coments and left untouched in character strings (I think this is what happens in the non strict ISO sense.
Regards,
Albert |
|
Back to top |
|
 |
IanLambley
Joined: 17 Dec 2006 Posts: 506 Location: Sunderland
|
Posted: Mon Jun 28, 2010 11:26 am Post subject: |
|
|
Albert,
If you have old formatted style code, you may want to expand the tabs to the correct number of character positions for Fortran, rather than the standard 8, 16, 24 ...
I posted an old program to do this, try
http://forums.silverfrost.com/viewtopic.php?t=785
Ian |
|
Back to top |
|
 |
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2402 Location: Yateley, Hants, UK
|
Posted: Mon Jun 28, 2010 1:34 pm Post subject: |
|
|
It's a pity that <HT> is not in the standard, because it would make regular multiple indenting so much easier. I used to use it a lot when I was programming in Algol-60, and from what I see, people using the Fortran 90/95 statement-number-free style of code need it as a way of keeping track of what "begin" matches with what "end" (OK, Fortran doesn't have a "begin" - that's Algol, but it does have multiple equivalents).
However, it's only a pity if you do your programming like that, as <HT> is of very little use in Fortran 66/77 style of code. I got into the habit of tabbing to column 7 at one point, but removed them all as the interpretation of <HT> was different in my editor to my compiler, and that irritated me.
Subsequently, I haven't found it to be a great loss not to use <HT>
Eddie |
|
Back to top |
|
 |
Albert
Joined: 20 Jun 2010 Posts: 11
|
Posted: Mon Jun 28, 2010 6:39 pm Post subject: |
|
|
Ian,
Thanks for the offer / program I have translated all the <HT> in the code already (the ones FTN95 were the last few ones).
Best regards,
Albert |
|
Back to top |
|
 |
JohnCampbell
Joined: 16 Feb 2006 Posts: 2615 Location: Sydney
|
Posted: Tue Jun 29, 2010 12:54 am Post subject: |
|
|
Albert,
The problem with your wishes for <HT> is what should it mean ?
The main problem here is there is no consistent definition.
I've seen it be defined as multiples of 7 spaces.
My preferred indent for DO and IF constructs is only 3 characters.
If I use tabs in my editor, it replaces with spaces, but not 3 !
If I use NOTEPAD, it retains the <HT> in the file, but then if I open the file with anything else, the layout changes.
What do other compilers and IDE's interpret <HT> as ?
John |
|
Back to top |
|
 |
Albert
Joined: 20 Jun 2010 Posts: 11
|
Posted: Tue Jun 29, 2010 6:49 am Post subject: |
|
|
John,
I think there is a big misunderstanding growing in this thread.
At first I thought there is a problem in th FTN95 compiler regarding <HT<> flagged as not ISO conform. This is not the case thanks to Ian's explanation and more careful reading of the standard.
When the user uses <HT> in comment or a string it is his decision and he should know what he is doing. Theerfore I would have expected that the standard allows <HT> in comments and strings and does not touch them.
Like I wrote before I don't like using <HT>, merely due to the different handling of <HT> by different editors. You wrote that <HT> was expanded to 7 spaces, never saw that, most common used is, as far as I know 8.
Regards,
Albert |
|
Back to top |
|
 |
|