Click here to Skip to main content
15,867,756 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
lewist573-Jan-23 8:43
lewist573-Jan-23 8:43 
GeneralRe: Classic FORTRAN Pin
trønderen3-Jan-23 9:21
trønderen3-Jan-23 9:21 
GeneralRe: Classic FORTRAN Pin
lewist573-Jan-23 9:49
lewist573-Jan-23 9:49 
GeneralRe: Classic FORTRAN Pin
jsc423-Jan-23 10:53
professionaljsc423-Jan-23 10:53 
GeneralRe: Classic FORTRAN Pin
Peter_in_27803-Jan-23 11:07
professionalPeter_in_27803-Jan-23 11:07 
GeneralRe: Classic FORTRAN Pin
jsc423-Jan-23 23:25
professionaljsc423-Jan-23 23:25 
GeneralRe: Classic FORTRAN Pin
trønderen3-Jan-23 16:54
trønderen3-Jan-23 16:54 
GeneralRe: Classic FORTRAN Pin
lewist574-Jan-23 5:27
lewist574-Jan-23 5:27 
Thanks for your response.

The Simply Fortran 3 complier did not complain about the "FOR" between DO and variable, I had never seen that syntax, and just wanted to make sure this was not a misunderstanding on my part. 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.

I also have the Intel Fortran compiler which is supposed to be compliant with F66, and will try to run it through that when I have the time. All of my work is being done as a console program under Windows 10, using the Simply Fortran 3 program.

I am in the process of reverse engineering the code (manually refactoring to a certain degree), and will be happy to share the revised code when done. I do have a few questions for you, my apologies for asking; they involve subroutine SUBROUTINE:

1) The first line in the subroutine (re)declares the variables. I am a little rusty on subs, but it seems that this would reset them all back to zero? (BTW - I had to explicitly declare the variables in the main program as zero; the Simply Fortran compiler is based upon the GNU fortran compiler, and if you don't initialize the variables, it puts a non-zero value in each uninitialized variable, which messes up your program)
2) The compiler does not like it when you have variables declared as integers in the main program, and then re-declare them as one dimensional arrays within the sub (eg - IMPLICIT and LOGICAL)
3) I am reworking the program as a simple console program running under Windows 10. I don't seem to recognize the following syntax:

WRITE(variable, 'string')

what are these WRITE statements actually doing with the variable and then the string?


Last but not least, it appears that the subroutine FUNCTION does absolutely nothing. I did a listing of the variables before and after calling FUNCTION, and there were no changes. Was this by design?


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. I was also a TA as a mechanical engineer back in the '70s, and would also do things like this to my students.
Pound to fit, paint to match

GeneralRe: Classic FORTRAN Pin
trønderen4-Jan-23 8:53
trønderen4-Jan-23 8:53 
GeneralRe: Classic FORTRAN Pin
lewist576-Jan-23 16:02
lewist576-Jan-23 16:02 
GeneralLong filename problems in 2022? Pin
honey the codewitch24-Oct-22 14:40
mvahoney the codewitch24-Oct-22 14:40 
GeneralRe: Long filename problems in 2022? Pin
MarkTJohnson25-Oct-22 7:21
professionalMarkTJohnson25-Oct-22 7:21 
GeneralRe: Long filename problems in 2022? Pin
honey the codewitch25-Oct-22 8:22
mvahoney the codewitch25-Oct-22 8:22 
GeneralRe: Long filename problems in 2022? Pin
Jörgen Andersson25-Oct-22 21:28
professionalJörgen Andersson25-Oct-22 21:28 
GeneralRe: Long filename problems in 2022? Pin
honey the codewitch26-Oct-22 0:43
mvahoney the codewitch26-Oct-22 0:43 
GeneralRe: Long filename problems in 2022? Pin
Nelek4-Nov-22 15:28
protectorNelek4-Nov-22 15:28 
GeneralRe: Long filename problems in 2022? Pin
honey the codewitch4-Nov-22 15:49
mvahoney the codewitch4-Nov-22 15:49 
GeneralRe: Long filename problems in 2022? Pin
Nelek5-Nov-22 10:26
protectorNelek5-Nov-22 10:26 
GeneralRe: Long filename problems in 2022? Pin
Gary R. Wheeler10-Dec-22 6:33
Gary R. Wheeler10-Dec-22 6:33 
GeneralRe: Long filename problems in 2022? Pin
trønderen5-Nov-22 4:44
trønderen5-Nov-22 4:44 
GeneralRe: Long filename problems in 2022? Pin
Nelek5-Nov-22 10:25
protectorNelek5-Nov-22 10:25 
GeneralRe: Long filename problems in 2022? Pin
englebart15-Jan-23 10:05
professionalenglebart15-Jan-23 10:05 
GeneralRe: Long filename problems in 2022? Pin
JohnDG523-Jan-23 3:17
JohnDG523-Jan-23 3:17 
AnswerRe: Long filename problems in 2022? Pin
Emilie Kelleher27-Nov-22 21:52
Emilie Kelleher27-Nov-22 21:52 
NewsStrange apparatus Pin
RickZeeland20-Oct-22 19:09
mveRickZeeland20-Oct-22 19:09 

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.