Neil Carlson <[log in to unmask]> wrote:
> Wouldn't `SELECT CASE' be appropriate here?
Well, possibly, but it would need to select the right one of several
hundred segments of code, and do it for every item in the list of
required segments. Is a SELECT CASE with several hundred cases as
efficient as an IF-THEN-ELSE with on average half a dozen tests?
Or a single assigned GOTO?
> Perhaps I've missed something here, but it doesn't seem particularly
> relevent to your proposed ASSIGN solution that the segments are
> ordered and a single linear pass is made through the code (as long
> as your segment array is also ordered).
No, it isn't, but it's relevant to the IF-THEN-ELSE technique that I
have used.
> In terms of implementation, I don't see that the
> evaluation of an assigned goto could be any different than the
> evaluation of a select case.
Evaluation of an assigned goto just involves a jump to the stored
address. A select case with several hundred alternatives is a
different matter. Maybe a hash table would be fairly efficient; do
current compilers do it this way?
and Richard Maine <[log in to unmask]> wrote
> ASSIGN as defined in f77 is really quite a "hack".
I take this point, though I wasn't intending to do things like passing
the assigned values to subroutines, which I certainly wouldn't expect
to work reliably if at all.
--
Anthony Stone http://fandango.ch.cam.ac.uk/
University Chemical Laboratory, Email: [log in to unmask]
Lensfield Road, Phone: +44 1223 336375
Cambridge CB2 1EW Fax: +44 1223 336362
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|