Click here to Skip to main content
15,845,367 members

The Weird and The Wonderful

   

The Weird and The Wonderful forum is a place to post Coding Horrors, Worst Practices, and the occasional flash of brilliance.

We all come across code that simply boggles the mind. Lazy kludges, embarrassing mistakes, horrid workarounds and developers just not quite getting it. And then somedays we come across - or write - the truly sublime.

Post your Best, your worst, and your most interesting. But please - no programming questions . This forum is purely for amusement and discussions on code snippets. All actual programming questions will be removed.

 
GeneralRe: Classic FORTRAN Pin
trønderen3-Jan-23 10:21
trønderen3-Jan-23 10:21 
GeneralRe: Classic FORTRAN Pin
lewist573-Jan-23 10:49
lewist573-Jan-23 10:49 
GeneralRe: Classic FORTRAN Pin
jsc423-Jan-23 11:53
professionaljsc423-Jan-23 11:53 
GeneralRe: Classic FORTRAN Pin
Peter_in_27803-Jan-23 12:07
professionalPeter_in_27803-Jan-23 12:07 
GeneralRe: Classic FORTRAN Pin
jsc424-Jan-23 0:25
professionaljsc424-Jan-23 0:25 
GeneralRe: Classic FORTRAN Pin
trønderen3-Jan-23 17:54
trønderen3-Jan-23 17:54 
GeneralRe: Classic FORTRAN Pin
lewist574-Jan-23 6:27
lewist574-Jan-23 6:27 
GeneralRe: Classic FORTRAN Pin
trønderen4-Jan-23 9:53
trønderen4-Jan-23 9:53 
lewist57 wrote:
My recollection is that prior to, and including F77, there were dozens of "dialects" of Fortran because folks just wanted to add features in their compilers that were not in the standard, resulting in difficulties in porting the program between various machines and compilers.
That certainly matches my memories. I guess that is why the discussions to create the F77 standard looked more like mad dogs fighting than like academic style discussions Smile | :)
lewist57 wrote:
I do have a few questions for you, my apologies for asking; they involve subroutine SUBROUTINE:
Feel free to ask! I fear that I will have to disappoint you: I haven't looked at this code since my student days, 40+ years ago. The detail justifications for how we did it is mostly forgotten long time ago. And, I never programmed Fortran professionally. We did a few projects at the university. Since then, Fortran has just been an entry in the 'competence list' in my CV (and today, that must be considered a lie).

1) I am not sure about the (re)declaration of the values in SUBROUTINE. The code assumes that variables are initialized to zero - I thought that was defined by the Fortran standard. We had denied ourselves the use of (numeric) constants. If you want to honor this requirement, you may e.g. zero INTEGER by adding as the first statement "INTEGER = INTEGER - INTEGER".

2) I am sorry - I can't explain this one. If the compilers we used did allow such redefinition (the non-array arguments are never used), it would be an excellent way of confusing the code reader. Maybe that is why we did it that way. I don't remember.

3) The two arguments are the logical unit number, IF (= 1) being console output. The second argument is a format string. The first WRITE loop is the one indenting the line properly, which apparently is not valid in F77, as both our F77 compilers failed to do proper indentation. Maybe the format string could be updated to F77 standard; it just specifies two space characters to be output. The format is that of the FORMAT statement which requires the format string to be enclosed in parentheses, so the '(' and ')' are just to fulfill this requirement. It seems like the '$' is a quoting, to prevent the tokenizer from stripping away the space.

For the second WRITE loop, it seems to me that the format string could have been written '(I4)'; I have no recollection of why the '$' is there.

I have a vague memory of FUNCTION being there for a purpose, the program not working without it. I may be wrong - maybe we put it in there just to confuse people to believe that it had a purpose Smile | :)

I really appreciate that you spend time trying to make this program work! Unfortunately, I am too far away from you to give you - in the hand, in the meat world - the 🍺 I told I would give to the first one telling what the output of this program is, but you seem to be one who is likely to win the prize. If you decide to spend a vacation in Norway, I'll gladly buy you one!

lewist57 wrote:
Overall, this is an excellent program to torture new users of Fortran to drive home the point that even though you could use keywords as variables, you really should not.
And then ... Have you noticed my entries in the thread 'General Programming | Algorithms | Aide pour un programme langage c'? Through a lengthy discussion, in particular with jschell, I argue in favor of a programming language being defined in terms of a parser tree, with no (reserved or just predefined) keywords. An IDE working directly on a parse tree would represent structural information in binary format, making it visible to the user by e.g. typographic highlighting, but requiring the user to create structure by function keys or menu selections, rather than by keywords. Just like a document processor - it has no (reserved) keywords that you cannot use freely in your document, and there is nothing you can put into the text body that will confuse the binary structure information.

I really wish we could have a language defined by its abstract syntax rather than by textual keywords. But I am not holding my breath waiting for it to appear.
GeneralRe: Classic FORTRAN Pin
lewist576-Jan-23 17:02
lewist576-Jan-23 17:02 
GeneralLong filename problems in 2022? Pin
honey the codewitch24-Oct-22 15:40
mvahoney the codewitch24-Oct-22 15:40 
GeneralRe: Long filename problems in 2022? Pin
MarkTJohnson25-Oct-22 8:21
professionalMarkTJohnson25-Oct-22 8:21 
GeneralRe: Long filename problems in 2022? Pin
honey the codewitch25-Oct-22 9:22
mvahoney the codewitch25-Oct-22 9:22 
GeneralRe: Long filename problems in 2022? Pin
Jörgen Andersson25-Oct-22 22:28
professionalJörgen Andersson25-Oct-22 22:28 
GeneralRe: Long filename problems in 2022? Pin
honey the codewitch26-Oct-22 1:43
mvahoney the codewitch26-Oct-22 1:43 
GeneralRe: Long filename problems in 2022? Pin
Nelek4-Nov-22 16:28
protectorNelek4-Nov-22 16:28 
GeneralRe: Long filename problems in 2022? Pin
honey the codewitch4-Nov-22 16:49
mvahoney the codewitch4-Nov-22 16:49 
GeneralRe: Long filename problems in 2022? Pin
Nelek5-Nov-22 11:26
protectorNelek5-Nov-22 11:26 
GeneralRe: Long filename problems in 2022? Pin
Gary R. Wheeler10-Dec-22 7:33
Gary R. Wheeler10-Dec-22 7:33 
GeneralRe: Long filename problems in 2022? Pin
trønderen5-Nov-22 5:44
trønderen5-Nov-22 5:44 
GeneralRe: Long filename problems in 2022? Pin
Nelek5-Nov-22 11:25
protectorNelek5-Nov-22 11:25 
GeneralRe: Long filename problems in 2022? Pin
englebart15-Jan-23 11:05
professionalenglebart15-Jan-23 11:05 
GeneralRe: Long filename problems in 2022? Pin
JohnDG523-Jan-23 4:17
JohnDG523-Jan-23 4:17 
AnswerRe: Long filename problems in 2022? Pin
Emilie Kelleher27-Nov-22 22:52
Emilie Kelleher27-Nov-22 22:52 
NewsStrange apparatus Pin
RickZeeland20-Oct-22 20:09
mveRickZeeland20-Oct-22 20:09 
GeneralRe: Strange apparatus Pin
peterkm21-Oct-22 2:01
professionalpeterkm21-Oct-22 2:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.