From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00, PP_MIME_FAKE_ASCII_TEXT autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,bda36258b2fe9834 X-Google-Thread: 1094ba,3354bcb01bfd8111 X-Google-Attributes: gid103376,gid1094ba,public X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!news3.google.com!news.glorb.com!news-in.ntli.net!newsrout1-win.ntli.net!ntli.net!diablo.theplanet.net!news.theplanet.net!not-for-mail From: "Les" Newsgroups: comp.lang.ada,comp.lang.fortran Subject: Re: Shortcut logicals (was: Re: F200x ) Date: Tue, 1 Feb 2005 14:56:31 -0000 Message-ID: References: <1107259211.c5d05dcbf8695b73b67b208313002b2b@teranews> <41ff79df$0$538$ba620e4c@news.skynet.be> <1107266645.d89440009860d548c1e3d72cdc821e0c@teranews> NNTP-Posting-Host: 213.249.249.162 X-Trace: newsreaderg1.core.theplanet.net 1107269784 29461 213.249.249.162 (1 Feb 2005 14:56:24 GMT) NNTP-Posting-Date: 1 Feb 2005 14:56:24 GMT X-Complaints-To: abuse@theplanet.net X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 Xref: g2news1.google.com comp.lang.ada:8114 comp.lang.fortran:10061 Date: 2005-02-01T14:56:24+00:00 List-Id: "Martin Krischik" wrote in message news:1107266645.d89440009860d548c1e3d72cdc821e0c@teranews... > Adrien Plisson wrote: > > > Martin Krischik wrote: > >> Christoph Grein wrote: > >>>You'll find > >>>relation and relation gives an expression, > >>>relation and then relation also gives an expression. > >>>But there is no syntax rule to combine an expression with a relation. > >>>You can only combine a parenthesized expression (a primary) with a > >>>relation. > >> > >> > >> Sure, you are right. But that rule means that: > >> > >> X or Y and Z > >> > >> is not valid either. Not that I ever noticed - I would always use '()' on > >> such a term. > > > > it isn't valid. GNAT 3.15p says: mixed logical operators in expression. > > > > See RM Introduction - design goals (�7): > > "error-prone notations have been avoided" > > > > and this construct is error-prone (especially if you are used to code > > in other languages than Ada, since each language has its own different > > operator precedence). the use of parenthesis clarifies the expression > > and leverages any ambiguities. > > I fully agree with you here - and most Ada users will do as well. I would > use () in C and C++ as well - for clarity. > > This is of corse a cross post with comp.lang.fortran and I wonder how they > see our solution to the problem. Is it suitable for Fortran 2003 as well or > do they need another solution? My own personal preference is for clarity of (a) readability and (b) maintainablity. Relying on my memory for operator precedence (or anything else, as anyone in my family will testify) is unreliable. Hey I even have to look up the relationship between TRUE and FALSE with 0 and 1 (or is it 1 and 0) :-) So I use ( ) even if they are redundant. I would tend to split a complex IF test into multiple tests - where possible. Situations where IF (X .and. Y) have side effects (X and/or Y being functions say, either affecting the other) I also try to avoid and work round another way. My style may be "wordy", or niaive, or not to the taste of others, but as long as I get correct and reasonably efficient code my employer and the clients will be happy. Les > > With Regards > > Martin > -- > mailto://krischik@users.sourceforge.net > http://www.ada.krischik.com