Silverfrost Forums

Welcome to our forums

Error 72: Line contains the character '<HT>'

27 Jun 2010 9:52 #6560

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

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

27 Jun 2010 10:40 #6562

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:

/ignore 25 Regards Ian

27 Jun 2010 10:58 #6563

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

27 Jun 2010 12:50 #6567

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

27 Jun 2010 2:34 #6568

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

27 Jun 2010 5:46 #6570

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

27 Jun 2010 6:35 #6571

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

28 Jun 2010 12:29 #6573

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

28 Jun 2010 5:56 #6575

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

28 Jun 2010 10:26 #6576

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 https://forums.silverfrost.com/Forum/Topic/547 Ian

28 Jun 2010 12:34 #6577

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

28 Jun 2010 5:39 #6579

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

28 Jun 2010 11:54 #6582

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

29 Jun 2010 5:49 #6583

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

Please login to reply.