TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: ASHER DENSMORE-LYNN
from: DARIN MCBRIDE
date: 1997-07-25 18:36:00
subject: Sunir ventures into C++

 -=> Quoting Asher Densmore-Lynn to Balog Pal
 AD> 20 Jul 97 11:24, Balog Pal wrote to Sunir Shah:
 
 SS>> I hate five major things about C++ so far:
 
 SS>> /* 2. Declaring data in random places */
 SS>> int HiIAmRandomlyDeclaredHere;
 
 BP> Another thing I did never forgive in C. I write my code. I need an
 BP> additional local. Why on earth I have to go up, search start of the
 BP> block and insert it there instead of putting it right there?
 AD> Code readability, and it makes it easier on the compiler, but the
 AD> first one is the real one. Nothing but code readability. I programmed
Yech.  No, this feature was added exactly FOR readability.  By placing
variables close to code, it makes both easier to understand.  The human mind
can only keep track of 7 +/- 2 things at a time.  By putting all 537
variables at the top of your function, you make it hard to follow.  However,
by putting the variables close to where they're used, the reader is more
likely to be able to understand what a variable's job is because there is
less to remember at a time.
 AD> Notice that a lot of Sunir's complaints are just what the compiler
 AD> ALLOWS -- things that are bad coding practice. I agree; if I'm looking
Nope - they're considered _good_ coding practice.  Get one of Sunir's
favourite books: Code Complete.  They'll give ya the rundown, and tell you
how to emulate this feature in C (it'll be a non-issue soon as the next ANSI
C revision may allow this).
 AD> at your code, I don't want to have to wade around, looking for random
 AD> declarations.
If you have to, then, yes, it's bad code.  However, good coding, with this
feature, means that the declaration is most likely on the same visual page as
where it's being used.
 AD> Think your functions through before you set hand to keyboard -- you
 AD> really should know the vars you'll need before you do anything more
 AD> than prototype it.
Except when debugging...
... Answers: $1, Short: $5, Correct: $25, dumb looks are still free.
--- FastEcho 1.46
---------------
* Origin: House of Fire BBS - Toronto - (416)601-0085 - v.34 (1:250/536)

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