home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.fortran
- Path: sparky!uunet!elroy.jpl.nasa.gov!nntp-server.caltech.edu!draco.macsch.com!convex.is.macsch.com!dnl
- From: dnl@convex.is.macsch.com (David Lombard)
- Subject: Re: Logical operators and operands
- Message-ID: <1992Nov20.205801.3839@draco.macsch.com>
- Sender: usenet@draco.macsch.com (Usenet Poster)
- Organization: MacNeal-Schwendler Corp.
- References: <BxwrJC.GME@cs.uiuc.edu> <30476@nntp_server.ems.cdc.com> <30502@nntp_server.ems.cdc.com>
- Date: Fri, 20 Nov 92 20:58:01 GMT
- Lines: 53
-
- In article <30502@nntp_server.ems.cdc.com> mstemper@ems.cdc.com writes:
- >
- >#pragma opinions ON
- >
- >This seems dumb! Why shouldn't the operators for equality and
- >inequality be the same, no matter what type of operands are
- >used? It seems to me that this is poor language design. Can
- >somebody come up with a plausible excuse for this? Is it:
- > a) Tradition
- > b) History
- > c) Easier to optimize compilers
- > d) Grandfathered in
- >
- >#pragma opinions OFF
- >
-
- The *problem* with a comparison such as ( _logical_var_ .eq. .TRUE. )
- is that you're obfuscating the meaning of the test. For example,
- would you write ( 1.eq.1 )? Remember, a logical var _already_ has
- a value of .TRUE. or .FALSE., an expression such as A.EQ.B is
- creating a logical value (i.e., .TRUE. or .FALSE.). Don't these
- comparisons look a little bizarre to you?
-
- IF( LOGVAR.EQ..TRUE. ) ...
- IF( LOGVAR.NE..TRUE. ) ...
- IF( LOGVAR.EQ..FALSE. ) ...
- IF( LOGVAR.NE..FALSE. ) ...
- IF( .NOT.LOGVAR.EQ..TRUE. ) ...
- IF( .NOT.LOGVAR.NE..TRUE. ) ...
- IF( .NOT.LOGVAR.EQ..FALSE. ) ...
- IF( .NOT.LOGVAR.NE..FALSE. ) ...
- IF( LOGVAR.EQ..NOT..TRUE. ) ...
- IF( LOGVAR.NE..NOT..TRUE. ) ...
- IF( LOGVAR.EQ..NOT..FALSE. ) ...
- IF( LOGVAR.NE..NOT..FALSE. ) ...
- IF( .NOT.LOGVAR.EQ..NOT..TRUE. ) ...
- IF( .NOT.LOGVAR.NE..NOT..TRUE. ) ...
- IF( .NOT.LOGVAR.EQ..NOT..FALSE. ) ...
- IF( .NOT.LOGVAR.NE..NOT..FALSE. ) ...
-
- Aren't the following just a tad cleaner?
-
- IF( LOGVAR ) ...
- IF( .NOT.LOGVAR ) ...
-
- Regards,
- DNL
-
- MY_COMMENTS = MY_OPINIONS = NOBODY_ELSES;
-
- David N. Lombard The first thing we do, The MacNeal-Schwendler Corp
- dnl@macsch.com Let's kill all the lawyers. 815 Colorado Blvd
- (213) 259-4911 II Henry VI, IV.ii Los Angeles, CA 90041
-