TIP: Click on subject to list as thread! ANSI
echo: c_echo
to: Neil Heller
from: Darin McBride
date: 1998-09-05 01:10:32
subject: A MATTER OF STYLE

NH> (an integer variable) is less than 5 and false otherwise.  I would
 NH> write:

 NH> foobool = (intvar < 5);

 NH> This seems straight forward and easy to understand to me.  However
 NH> I've never seen this style used by another programmer.

I rarely end up doing that... but will if it's that easy.  What I mean is
that I would more usually have:

foobool = isInRange(intvar);

And then I would have elsewhere:

BOOL isInRange(int i)
{
  // code that manipulates i, possibly grabbing some system variables,
  // such as the screen width, for example.

  return i < 5;
}

Same effect on coding, as far as I'm concerned.

My two cents.  :-)


---
* Origin: Tanktalus' Tower BBS (1:250/102)
SEEN-BY: 396/1 622/419 632/0 371 633/260 267 270 371 634/397 635/506 728 810
SEEN-BY: 639/252 670/213 218
@PATH: 250/102 201 99 396/1 633/260 635/506 728 633/267

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™.