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 

Module- / Routine-Names: Conventions

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



Joined: 28 Jul 2017
Posts: 75

PostPosted: Wed Aug 09, 2017 10:43 am    Post subject: Module- / Routine-Names: Conventions Reply with quote

Hello, everyone,

I was wondering, whether any conventions or recommended practices for naming modules, subroutines, functions, etc. in fortran exist. In some books I have I found conventions for variables, but modules and routines seem to be named arbitrarily.

Currently I name them as follows:
Modules - mod_module_name (i.e. mod_parameters)
Subroutines / Functions - action_routine_name (i.e. calc_area_triangle)
Back to top
View user's profile Send private message
LitusSaxonicum



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

PostPosted: Wed Aug 09, 2017 11:36 am    Post subject: Reply with quote

Subroutine names don't need anything special, do they, as they are always associated with 'CALL'.

I don't know if you have got round to Clearwin+ yet, but it requires lots of call-back functions, and 'action_routine_name' on its own isn't enough to remind you that you are dealing with a function, especially as the call-back routines are usually EXTERNAL within a WINIO@ function list of parameters, so they don't have any parameters of their own, and not even (). My trick is to add something to the name: e.g. _FN or _CBF on the end.

I also have very long source codes divided over many files, and I maintain another couple of files called WHEREIS.FOR and WHATIS.FOR that tell me (respectively)where every subroutine and function can be found, and what every variable does. WHATIS.FOR is a hangover from days when variable names had to be short. Then, when I have got things working to my satisfaction, I add comments adjacent to subroutine and function calls duplicating the information from WHEREIS.FOR so when I am reading my long-ago-written code I know where to look for that link. In any case, I put a list of subroutines and functions at the start of every source code file with line numbers so I know where to look, and also try to keep source code files down to 2000 lines or so.

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 -> General 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