home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!haven.umd.edu!darwin.sura.net!newsserver.jvnc.net!yale.edu!yale!gumby!destroyer!ncar!noao!amethyst!organpipe.uug.arizona.edu!news
- From: dave@cs.arizona.edu (Dave Schaumann)
- Newsgroups: comp.lang.c
- Subject: Re: HELP : C programming Guideline
- Message-ID: <1993Jan12.024932.27939@organpipe.uug.arizona.edu>
- Date: 12 Jan 93 02:49:32 GMT
- References: <C0pBDG.7Ky@news2.cis.umn.edu>
- Sender: news@organpipe.uug.arizona.edu
- Reply-To: dave@cs.arizona.edu (Dave Schaumann)
- Organization: University of Arizona
- Lines: 40
- In-Reply-To: smahn@vx.cis.umn.edu (Seokmin Ahn)
-
- In article <C0pBDG.7Ky@news2.cis.umn.edu>, smahn@vx (Seokmin Ahn) writes:
- >I am looking for a C (not C++) programming guideline.
-
- Hmm... let's see... how about these:
-
- 0. Understand the problem you're trying to solve. The better
- you understand it, the better you can solve it.
-
- 1. Know the language. The strengths and the weaknesses.
- Think about how to use the strengths in your application
- while avoiding the weaknesses.
-
- 2. Portability is an issue that should be considered early
- on. The range of target machines (and OS's) can greatly
- effect fundamental design decisions.
-
- 3. Don't abuse the preprocessor.
-
- 4. Adopt a coding style (indentation, brace placement, naming
- conventions, etc) and stick to it. It's probably best to
- write out the conventions (if they're not already given to
- you). It's probably also a good idea to make a list of ways
- you think the style could be improved...
-
- 5. Look at other peoples' code. It will give you a perspective
- you can't find working on your own, and it will also give you
- a better idea of what's good and what's bad.
-
- 6. Know what constructs cause undefined behavior and avoid them.
- As a corollary, avoid overly-complex constructs.
-
- There's also some pointers to style guides available via ftp in the FAQ
- (which should still be available at your site -- just search backward
- for a post with "Frequently" in the title, and you should find it)
-
- --
- You unlock this door with the key of imagination. Beyond it is another
- dimension: a dimension of sound, a dimension of sight, a dimension of mind.
- You're moving into a land of both shadow and substance, of things and ideas.
- You've just crossed over into... the Twilight Zone.
-