TIP: Click on subject to list as thread! ANSI
echo: c_echo
to: KURT KUZBA
from: BRUCE WEDDING
date: 1998-05-25 13:12:00
subject: redundancy

KK>BW> KK> if(-1L == length)
KK>BW> KK>   I had
KK>BW> KK> if(-1L = length)
KK>   That was the point, actually. I got an error because I
KK>   tried to assign a variable to a constant, and had to change
KK>   the = to == before I could successfully compile the code.
KK>   If I had used the reverse, natural order, if(length = -1L),
KK>   then the error would have passed the compiler unnoticed,
KK>   where it would have lain unseen until the conditions were
KK>   right to cause a program malfunction, at which time, one
KK>   would have to haul out the source and hunt down the bug,
KK>   perhaps months after writing it, and with badly faded
KK>   familiarity. The expedient method of comparing in reverse
KK>   order ensures that assignment is not accidentally invoked
KK>   without costing anything in development or debugging time.
Just tested Borland 3.1 and MSVC 5.0.  Both generated a warning for the
assignment within an expression.  I also use GCC for 68K at work and it
does the same.
Bruce
___
 X OLX 2.1 TD X It's only a hobby ... only a hobby ... only a
--- Maximus/2 3.01
---------------
* Origin: COMM Port OS/2 juge.com 204.89.247.1 (281) 980-9671 (1:106/2000)

SOURCE: echomail via exec-pc

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