TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Thomas Seeling
from: Darin McBride
date: 1997-01-19 20:45:44
subject: writing REXX DLL`s

TS>  JdBP> if (!terminating) {
 TS>  JdBP> } else {

 TS> I don't think it is good style to handle both cases of 
 TS> a boolean decision and begin with the negated part. 
 TS> Probably the compiler can optimize it, but I wouldn't 
 TS> trust this :)

 TS> if (terminating) {}
 TS> else {}

 TS> is clearer, although your style fits the causality better :-)

Generally people try to put the error handling (and other less-frequently
run) code later.  "Terminating" is likely an "error"
(or at least not the normal path of execution), and probably should be
handled later.  OTOH, I prefer my variables to be positive as well - rather
than "terminating," have "still_going" or
"alive" or even (if all is lost), "not_terminating". 
:-)  You win both ways - you don't continually negate the variable, and you
still get to put the most-executed code first where we can read it easier. 
:-)


--- Maximus/2 3.01
* Origin: Tanktalus' Tower BBS (PVT) (1:342/708)
SEEN-BY: 50/99 54/99 270/101 620/243 625/110 160 711/401 430 808 934 712/311
SEEN-BY: 712/407 505 506 517 623 624 704 713/317 800/1
@PATH: 342/5015 61 3615/50 396/1 270/101 712/624 711/934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.