home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!spool.mu.edu!agate!dog.ee.lbl.gov!news!nosc!visicom!rlk
- From: rlk@VisiCom.COM (Bob Kitzberger)
- Newsgroups: comp.lang.ada
- Subject: Language pitfalls (was Re: FORTRAN bug)
- Message-ID: <252@visicom.com>
- Date: 14 Dec 92 21:57:23 GMT
- References: <EACHUS.92Dec7184734@oddjob.mitre.org> <1992Dec8.072300.21473@smds.com> <1992Dec8.172551.16780@newshost.lanl.gov> <1992Dec9.060218.23940@seas.gwu.edu> <1992Dec11.132942.24054@mksol.dseg.ti.com> <1992Dec11.163811@lglsun.epfl.ch> <1992Dec14.165537.18275@mks
- Sender: news@VisiCom.COM
- Lines: 33
-
- Experienced C programmers have rules of thumb that they follow in order
- to help them to avoid language "problems". Ada programmers also have
- rules of thumb to help them avoid language "problems". If you were to
- list the top five C rules of thumb, they'd be something like:
-
- 1. Use conditional preprocessor directives in .h files to avoid
- multiple file inclusions (oops! That's a C preprocessor rule ;-)
- 2. Always use curly braces in conditionals
- 3. Be careful to use '==' when you mean it, instead of '='
- 4. Always malloc one more byte then your array length for strings
- 5. Always use 'break' in each switch case, unless you really mean it
-
- The top five rules of thumb for Ada are probably something like:
-
- 1. Don't get carried away using tasks as units of decomposition
- 2. Don't use the predefined types; define your own types
- 3. Use packages as units of decomposition.
- 4. Use private types to hide implementation details
- 5. Avoid the USE clause; consider RENAMES instead.
-
- Note that the Ada rules of thumb are more geared towards programming
- in the large, and reflect the fact that the Ada programmer spends less
- time on annoying *run-time* syntax glitches (*), and more time on
- encapsulation and decomposition issues.
-
- .Bob.
-
- (*) Of course, Ada programmers spend more time with compile-time syntax
- errors than anyone else ;-)
- ----------------
- Bob Kitzberger VisiCom Laboratories, Inc.
- rlk@visicom.com 10052 Mesa Ridge Court, San Diego CA 92121 USA
- +1 619 457 2111 FAX +1 619 457 0888
-