Article View: rec.games.programmer
Article #145Re: TP or C ?
From: Chris Gray
Date: Thu, 23 Jul 1992 04:01
Date: Thu, 23 Jul 1992 04:01
35 lines
2051 bytes
2051 bytes
In article <1992Jul22.000454.24871@ccu1.aukuni.ac.nz> stuartw@ccu1.aukuni.ac.nz writes: > base_ptr[offset]=value; > > or > > *base_ptr+offset=value; He he! I just love it when someone saying how great C is messes up with a common C error! The above two are of course not equivalent - extra parentheses are needed around the 'base_ptr+offset' in the second form. I've been skipping through these articles on 'TP or C', not realizing I've been missing the glorious fun of putting C down! C is one of the unfriendliest languages I've come in contact with, especially in the ways it is used by far too many people. Folks! Use full prototypes. Turn on all possible warning flags. Make your code compile clean. Use some fairly standard programming style. Make your file global variables instantly distinguishable from your local ones. Avoid inter-file globals (externs) like the plague. Don't overuse macros. Make ALL macro names in all upper case (except perhaps true/false). Anyone (including yourself after a few years) who has to work with your code will greatly thank you. My relevant experience: I've written an ANSI C compiler at work. I use ANSI C at work almost exclusively. I've written other compilers, including the one I use here at home. I've probably written over half a million lines of high-level-language code over the years, so I've learned a LITTLE about how to do it in a maintainable way, usually without sacrificing efficiency. -- Chris Gray alberta!ami-cg!cg or cg%ami-cg@CS.UAlberta.CA
Technical Details
Message-ID:
<cg.0afn@ami-cg.UUCP>Path:
arc1-ca.pugleaf.net!sparky!uunet!wupost!gumby!destroyer!ubc-cs!unixg.ubc.ca!kakwa.ucs.ualberta.ca!ami-cg!cgReferences:
<1992Jul15.153252.25417@esds.mdc.com> <lzam8cd@lynx.unm.edu> <76207@ut-emx.uucp> <1992Jul20.203317.10143@esds.mdc.com> <1992Jul22.000454.24871@ccu1.aukuni.ac.nz>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!wupost!gumby!destroyer!ubc-cs!unixg.ubc.ca!kakwa.ucs.ualberta.ca!ami-cg!cg From: cg@ami-cg.UUCP (Chris Gray) Newsgroups: rec.games.programmer Subject: Re: TP or C ? Distribution: world Message-ID: <cg.0afn@ami-cg.UUCP> References: <1992Jul15.153252.25417@esds.mdc.com> <lzam8cd@lynx.unm.edu> <76207@ut-emx.uucp> <1992Jul20.203317.10143@esds.mdc.com> <1992Jul22.000454.24871@ccu1.aukuni.ac.nz> Date: 22 Jul 92 21:01:46 MST Organization: Not an Organization Lines: 35