forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Continuation for Fixed form

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Suggestions
View previous topic :: View next topic  
Author Message
DanRRight



Joined: 10 Mar 2008
Posts: 1620
Location: South Pole, Antarctica

PostPosted: Thu Oct 17, 2013 2:33 am    Post subject: Continuation for Fixed form Reply with quote

Will FTN95 violate anything compiling fixed form Fortran texts when it will allow the & sign at the end of line as a continuation sign and not treat it as an error if on the next line it will find in 6th position & sign again?

That way we would share multiline sentences with free form format sources without any changes
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 4999
Location: Salford, UK

PostPosted: Thu Oct 17, 2013 7:54 am    Post subject: Reply with quote

If I am understanding this correctly then it is already acceptable both to FTN95 and the Fortran standard.

If not then can you provide a sample.
Back to top
View user's profile Send private message
davidb



Joined: 17 Jul 2009
Posts: 526
Location: UK

PostPosted: Thu Oct 17, 2013 6:45 pm    Post subject: Reply with quote

It works for me Smile

Code:

      Print *,'This just ',                                             &
     &        'works'                                 
      end

_________________
Programmer in: Fortran 77/95/2003/2008, C, C++ (& OpenMP), java, Python, Perl
Back to top
View user's profile Send private message
DanRRight



Joined: 10 Mar 2008
Posts: 1620
Location: South Pole, Antarctica

PostPosted: Thu Oct 17, 2013 9:09 pm    Post subject: Reply with quote

If the first & is in less then 73th position compiler gives an error
Back to top
View user's profile Send private message
davidb



Joined: 17 Jul 2009
Posts: 526
Location: UK

PostPosted: Thu Oct 17, 2013 9:36 pm    Post subject: Reply with quote

If the first & is before column 73 then its not valid Fixed form Fortran.

It is valid free form Fortran, however.

What you probably need is an "extension" that treats a trailing & as if it was always in column 73.
_________________
Programmer in: Fortran 77/95/2003/2008, C, C++ (& OpenMP), java, Python, Perl
Back to top
View user's profile Send private message
DanRRight



Joined: 10 Mar 2008
Posts: 1620
Location: South Pole, Antarctica

PostPosted: Thu Oct 17, 2013 11:20 pm    Post subject: Reply with quote

Yes, that would be the next question. Can anyone using other Fortran compilers check if the continuations with arbitrary position of & in the first line I'm talking about is already a default or allowed for fixed format sources there. If not are there any objections to add this to ftn95?

This becomes terribly annoying issue I barely can stand. And it leads to errors. We now will live for a long time with both free and fixed form sources in our codes and this suggestion will substantially simplify text exchange between two
Back to top
View user's profile Send private message
JohnCampbell



Joined: 16 Feb 2006
Posts: 1807
Location: Sydney

PostPosted: Fri Oct 18, 2013 12:30 am    Post subject: Reply with quote

Dan,

You don't have my support on this one. I don't think that fixed format source rules should be changed. They are there to support old format FORTRAN code.
If you want longer lines then go to free format. If you want longer lines again then most compilers have an option to extend the length, such as /WIde_source.

I've been a convert to free format for many years. I must admit that I have re-written clearwin.ins without the 72 character limitation, so that it is easier to read. ( perhaps the compiler directive for free format could be placed in this file and only apply within the include file )

John
Back to top
View user's profile Send private message
DanRRight



Joined: 10 Mar 2008
Posts: 1620
Location: South Pole, Antarctica

PostPosted: Fri Oct 18, 2013 7:27 am    Post subject: Reply with quote

John,

From my fox hole i yet to find anything in older texts what my suggestion breaks. Things are that fixed form will be used for ages and will co-exist with free form. Rewriting fixed form sources to free form for large codes is invitation for the hell. So when there will be similar parts in both sources they will be different unless you will be counting besides 6 spaces 73 too like in the davidb's example above. I started using it few weeks back after our conversation about this but i do not like it, it is extremely unnatural and inconvenient. Expanding and editing such parts makes you hate programming.

What currently typically happens when you do free/fixed continuations differently is that if your editor searches/replaces for example some patterns in the texts, it might miss free or fixed form instances because they have different methods of continuations. Sometimes you need to change 100s of similar text patterns in free and hundreds in fixed source parts (say, the same long multiline common block or multiline Clearwin control).

My suggestion makes them 100% the same and looks absolutely natural and familiar to programmer's eye.

I'd also looked even further into darker territory and considered to allow free form way of continuation in fixed form texts so that you do not have to count spaces if two & symbols are present at the end of first line and the beginning of the next one. What this suggestion actually breaks? I do not see anything but of course welcome any criticism. FTN77/FTN95 were the most radical compilers from the beginning and allowed way too foreign things to co-exist peacefully with the Fortran text, like assembler, HTML and graphics extensions, why not to allow mixing free form Fortran in the fixed form parts ? That should be the most natural extension.


Last edited by DanRRight on Fri Oct 18, 2013 7:55 pm; edited 5 times in total
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 4999
Location: Salford, UK

PostPosted: Fri Oct 18, 2013 8:07 am    Post subject: Reply with quote

If this is a reasonable suggestion and is not a major task to implement then it could be supplied as a configurable command line option that is configured OFF by default. This would overcome John's reservations.
Back to top
View user's profile Send private message
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 1669
Location: Yateley, Hants, UK

PostPosted: Fri Oct 18, 2013 11:17 am    Post subject: Reply with quote

One of the great things about having the end-of-line continuation & in column 73 when you adopt the fixed-and-free convention, is that it tells you where column 73 is in your text editor! You then find yourself overrunning less often, although having & in column 73 (or later) makes that line tedious to edit, and you don't get any benefit if no such lines are in view when you are editing.

Eddie
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Suggestions All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group