walters@oksce1.okstate.edu (Harold G. Walters) (04/28/89)
Just though I'd save everyone the time of translating Henry Spencer's Ten Commandments for C Programmers to LaTeX. Now if I could only follow them.... % cmdmnt.tex \documentstyle[12pt]{article} \setlength{\textwidth}{6.5in} \setlength{\oddsidemargin}{0in} \setlength{\evensidemargin}{0in} \setlength{\topmargin}{0in} \setlength{\textheight}{8in} \pagestyle{empty} \flushbottom \begin{document} \begin{center} {\Large\bf The Ten Commandments for C Programmers} \linebreak {\large Henry Spencer} \end{center} \vfill \newcounter{cmdmnt} \begin{list}% {\Roman{cmdmnt}}{\usecounter{cmdmnt}\setlength{\rightmargin}{\leftmargin}} \item Thou shalt run {\em lint} frequently and study its pronouncements with care, for verily its perception and judgement oft exceed thine. \item Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end. \item Thou shalt cast all function arguments to the expected type if they are not of that type already, even when thou art convinced that this is unnecessary, lest they take cruel vengeance upon thee when thou least expect it. \item If thy header files fail to declare the return types of thy library functions, thou shalt declare them thyself with the most meticulous care, lest grievous harm befall thy program. \item Thou shalt check the array bounds of all strings (indeed, all arrays), for surely where thou typest ``foo'' someone someday shall type ``supercalifragilisticexpialidocious''. \item If a function be advertised to return an error code in the event of difficulties, thou shalt check for that code, yea, even though the checks triple the size of thy code and produce aches in thy typing fingers, for if thou thinkest ``it cannot happen to me'', the gods shall surely punish thee for thy arrogance. \item Thou shalt study thy libraries and strive not to re-invent them without cause, that thy code may be short and readable and thy days pleasant and productive. \item Thou shalt make thy program's purpose and structure clear to thy fellow man by using the One True Brace Style, even if thou likest it not, for thy creativity is better used in solving problems than in creating beautiful new impediments to understanding. \item Thy external identifiers shall be unique in the first six characters, though this harsh discipline be irksome and the years of its necessity stretch before thee seemingly without end, lest thou tear thy hair out and go mad on that fateful day when thou desirest to make thy program run on an old system. \item Thou shalt foreswear, renounce, and abjure the vile heresy which claimeth that ``All the world's a VAX'', and have no commerce with the benighted heathens who cling to this barbarous belief, that the days of thy program may be long even though the days of thy current machine be short. \end{list} \end{document} -- Harold G. Walters walters@1.ce.okstate.edu School of Civil Engineering okstate!oksce1!walters Oklahoma State University "If all you have is a hammer, Stillwater, OK 74078 everything looks like a nail".