Re: FORSTY - The Fortran Styler :-)



In article <in9oet$6jl$1@xxxxxxxxxxxxxxxxx>, dpb <none@xxxxxxx>
wrote:

Daniel, good luck in your pursuit of style; just remember GOTO is _NOT_
really evil at all, it's just (another) structured programming tool in
the right hands... :)

Almost all of the structured code ideas, select case,
if-then-elseif-else-end, do loops, and so on can be implemented as
if()goto. The advantage of the structures is that the branches are
"tame" and the code logic is easy to follow.

I would prefer to have some kind of structure that accomplishes the
same thing as if(error)goto, but there isn't. When you coerce one
of the structures into accomplishing this, the cure is worse than
the disease.

This is a separate topic, but the discussion reminds me of a
parallel compiler I used once. It was on shared-memory hardware,
and it focused on do-loop driven parallelism. You would place a
compiler directive just before the do-loop, and that would tell the
compiler that each pass through the loop could be done in separate
threads. But the compiler could not produce code to execute
arbitrary sections of code independently. So the work around to
accomplish this was something like:

!original code
....statement block 1...
....statement block 2...
....statement block 3...
....statement block 16...

!modified code
!parallel do-loop directive
do i = 1, 16
if (i.eq.1) then
...statement block 1...
elseif (i.eq.2) then
...statement block 2...
elseif (...) ! 13 more of these
elseif (i.eq.16)
...statement block 16...
endif
enddo

As you can see, there is no looping really occurring here, it was
just to trick the compiler in order to use the parallel do-loop
threading.

$.02 -Ron Shepard
.