Xref: utzoo comp.arch:4014 comp.lang.misc:1294 Path: utzoo!mnetor!uunet!husc6!sri-unix!quintus!ok From: ok@quintus.UUCP (Richard A. O'Keefe) Newsgroups: comp.arch,comp.lang.misc Subject: Re: FORTRAN Horror Message-ID: <800@cresswell.quintus.UUCP> Date: 23 Mar 88 08:41:39 GMT References: <24861@yale-celray.yale.UUCP> <1135@pembina.UUCP> <10037@steinmetz.steinmetz.ge.com> Organization: Quintus Computer Systems, Mountain View, CA Lines: 23 In article <10037@steinmetz.steinmetz.ge.com>, davidsen@steinmetz.steinmetz.ge.com (William E. Davidsen Jr) writes: > The arithmetic if is one of the few good things in FORTRAN ... > Of course I wouldn't suggest having it be implemented as goto's, but > some reasonable syntax, such as: > evaluate (fun(4,"test") < 22) > { < 0 action } > { equal action } > { > 0 action } What's wrong with typedef enum {LESS = -1, EQUAL = 0, GREATER = 1} Order; extern Order int_compare(int, int); switch (int_compare(fun(4,"test"), 22) { case LESS: ...; break; case EQUAL: ...; break; case GREATER: ...; break; } No new syntax needed. Where something like this pays off is when you are comparing strings or complicated records, and you don't want to do it twice, but that is when you are defining your own comparison function anyway. This is really a comp.lang.misc issue.