please dont rip this site

The Ten Commandments of C Style

A remedial course for caps criminals

by Lawrence Lile

  1. Woe be to those errant scribes who ignore capitalization in the writing of the C program, and a plague of frogs on those who turn off the switch of capitalization.
     
  2. Thou shalt not capitalize statements such as the "if " or the "for " .
     
  3. CONSTANTS shall be shouted to the multitudes in all caps, from every rooftop and steeple, as they are the unchanging firmament and change not through all time, and woe be to those that confuse them with variables.
     
  4. Those Types and Structures which are user defined shall be presented with the first letter capitalized, as they are the high born, lest they be confused with the lesser variables, nor with the shouted CONSTANTS.
     
  5. variables shall be lower case, even as they start a sentence, for they are the low and common peasant workers doing the everyday drudgery of programming work, and must not be confused with the high-born Structures, nor with the ever-stable firmament of CONSTANTS.
     
  6. Brothers have come to blows o'er the use of long variable names, with many favouring the internal capitalization, thus the use of long int numberOfPeopleInHell; whereas others have countered with heated words that the proper way would be long int number_of_people_in_hell. Woe be to those who use either name, for it is likely not unique in the first six to eight letters, making some compilers gnash their teeth, while the true scope of the number of people in hell would vastly exceed the capacity of the long int, causing the dreaded plague which infecteth, locketh-up and rebooteth all computers from the lowly PIC to the mighty Cray.
     
  7. While much blood has been shed over the issue of the curly brace, and many are the programmers that have argued that opening curly braces should go on their own line, while others have protested with sword-in-hand that they must go on the same line as the statement, and many have come to blows over this, the closing curly brace shall be indented to the same level as the opening function.
     
  8. Thou shalt not comment the obvious. Those rapscallions and heathens who penned the line
    i++;  // Add one to i    
    

    shall be forever banned from the inner circle of C, though their resume grow long and their accomplishments and finished code stretch out before them like a lake of ASCII text. Likewise, any code which is not obvious, or obfuscates and bebothers the user, shall be extensively commented so as to make clear the intent of the programmer.
     

  9. Thou shalt comment the author, date, and revision of each C program, and lo, other comments shall be brief, descriptive, to the point, yet clear as the purest mountain spring water in their explanation and clarification of the code. Each function shall have as its companion a description of its function, its inputs and outputs, as each dog has its day and each actor his moment on the stage. Thou shalt document the purpose of each and every I/O pin in an embedded processor, and for each variable, data member or Structure there shall be a comment which shall illuminate and enlighten the reader of the program as to its use.
     
  10. Thou shalt properly indent programs, each subservient function being indented one level more than its master.
     

Archive:


file: /Techref/language/ccpp/10CStyle.htm, 4KB, , updated: 2023/1/31 17:35, local time: 2024/10/31 16:48,
TOP NEW HELP FIND: 
3.137.198.239:LOG IN
©2024 PLEASE DON'T RIP! THIS SITE CLOSES OCT 28, 2024 SO LONG AND THANKS FOR ALL THE FISH!

 ©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE!

<A HREF="http://linistepper.com/techref/language/ccpp/10CStyle.htm"> The Ten Commandments of C Style</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type a nice message (short messages are blocked as spam) in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.


Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?