Click here to Skip to main content
16,018,353 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 16:54
trønderen3-Jan-23 16:54 
GeneralRe: Classic FORTRAN Pin
lewist574-Jan-23 5:27
lewist574-Jan-23 5:27 
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 
Some more progress:

1) the darn dollar sign $

From your response: "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."

So my interpretation is that WRITE(IF, '(''$ '')') simply writes two spaces, and can be replaced by write(*,*)' ' where there are two spaces between the single quotes. That makes a lot of sense. The $ sign has been used in various compilers to indicate a macro, or as a suppression of line return, so that helps a lot. It might be some compiler specific feature.

2) The compiler is not happy with the first do loop in SUBROUTINE:

DO FOR RETURN = EXTERNAL, EXTERNAL - IF
IMPLICIT(RETURN) = LOGICAL(RETURN) + LOGICAL(RETURN - IF)
END DO

The complier will not throw an error or warning (either when compiling or running), but as I see it, the first time through EXTERNAL = 0 and IF = 1, so you are doing a negative increment

DO FOR RETURN = 0, -1

when I test a program with a do loop like above, there are no errors or warnings from the compiler, and the program runs, but it apparently just skips over the do loop and its contents.

For example, this code

write(*,*)'before do loop'
do RETURN = 0, -1
write(*,*)'inside do loop'
end do
write(*,*)'after do loop'

produces the following output:
before do loop
after do loop

3) The declaration of variables in the main program have IMPLICIT and LOGICAL as scalars, and then are redeclared as arrays in SUBROUTINE; there is no definition of the size of the array (should be 13). Likewise, EXTERNAL is declared as an real in the main program, and redeclared as an integer in SUBROUTINE.

4) last but not least, F66 and F77 limited variables, subroutines, functions, program names to 6 characters; how did your compiler accept the ones that are 7 or more characters long?

Thanks again!
Pound to fit, paint to match

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 
GeneralRe: Strange apparatus Pin
peterkmx21-Oct-22 1:01
professionalpeterkmx21-Oct-22 1:01 
GeneralRe: Strange apparatus Pin
MarkTJohnson21-Oct-22 3:15
professionalMarkTJohnson21-Oct-22 3:15 
GeneralRe: Strange apparatus Pin
RickZeeland21-Oct-22 3:26
mveRickZeeland21-Oct-22 3:26 
GeneralRe: Strange apparatus Pin
Mike Hankey21-Oct-22 4:54
mveMike Hankey21-Oct-22 4:54 
GeneralRe: Strange apparatus Pin
MarkTJohnson21-Oct-22 5:14
professionalMarkTJohnson21-Oct-22 5:14 
GeneralRe: Strange apparatus Pin
Nelek22-Oct-22 12:56
protectorNelek22-Oct-22 12:56 

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.