Re: FORSTY - The Fortran Styler :-)

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

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

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

$.02 -Ron Shepard

Relevant Pages

  • Re: Include Statement
    ... #elseif USE_VERSION = 2 then ... If VB.NET support these compiler directives, ... I never reuse "lines of code", ... ALL my source code gets compiled!!! ...
  • Re: Determining mex compiler
    ... >> was used when invoking the MATLAB compiler. ... >> elseif ~isempty) ...
  • Re: Determining mex compiler
    ... > I did some while ago something similar for "guessing" which ... > was used when invoking the MATLAB compiler. ... > elseif ~isempty) ...
  • Re: [Lit.] Buffer overruns
    ... > Douglas A. Gwyn wrote: ... The compiler will omit run-time safety checks if and only if it ... Do you have an example of a compiler that accomplishes this? ...