Author |
The C Programmer's Oath |
Doran Chief Marshal Galactic Navy
Joined: March 29, 2003 Posts: 4032 From: The Gideon Unit
| Posted: 2012-04-20 22:49  
On my Honor:
1. I will start my files with a file header
2. I will plan my program before I write it
3. I will comment my code
4. I will close my comments immediately after I open them and before I write my notes in between
5. I will not forget that C is case sensitive
6. I will not forget semicolons
7. I will use indentation to keep my code clear
8. I will declare my variables before I use them
9. I will declare my variables at the start of each new block of code
10. I will write a closed parenthesis immediately after I write an open one and before I write code in btween
11. I will put a closed curly brace immediately after I write one and before I write code in between
12: I will not use "magic numbers".
a. I will uses #define's instead
13. I will declare my functions before I use them
14. I will proto-type my functions and put the proto-types in my header file or at the start of my program
15. I will not use globals without apt reson for them.
i.e. I will not be lazy with variables
while( iBreakTheseRules)
{
TheComplierWillSpitAndHissAndComplain();
}
/*End Program*/
dated 8/2/01
_________________
|
Fluttershy Fleet Admiral
Joined: September 24, 2011 Posts: 778 From: Fluttershy
| Posted: 2012-04-21 04:07  
Oh god... I'm guilty of the Magic Numbers thing...
I'm better about it now, though, I usually make sure to give each a simple yet descriptive name.
Can't say how many times I've returned to an old project, asking myself "What the hell does this number even do here?!"
_________________
|
Lithium Chief Marshal
Joined: June 29, 2003 Posts: 109
| Posted: 2012-04-21 04:27  
Do_Activate_f = (bool (*)(GEntityStructure *ent, GEntityStructure *traceEnt))0x200530F0;
OverwriteFunctionPointer((void *)0x20053BB6, (void *)((int)Hook_Do_Activate_f - 0x20053BBA));
(codes from my own project)
I thought often using magic numbers makes me a wizard lol
[ This Message was edited by: Lithium on 2012-04-21 04:33 ]
_________________
|
Fattierob Vice Admiral
Joined: April 25, 2003 Posts: 4059
| Posted: 2012-04-21 13:21  
http://lostatc.ytmnd.com/ ?
_________________
|
tucker32 Fleet Admiral
Joined: February 16, 2009 Posts: 142 From: deep jungle of vargo
| Posted: 2012-04-21 22:57  
I failed C programming
_________________
|
Eledore Massis [R33] Grand Admiral Templar Knights
Joined: May 26, 2002 Posts: 2695 From: tsohlacoLocalhost
| Posted: 2012-04-22 22:16  
($t,@m)=(1+int rand 10,'',"too much ","too few ");sub g{print
"Gimme your guess 1-10: ";syswrite(STDOUT,$m[<><=>$t])?g():$t;}
print"Bingo! It was @{[g()]} "
Not my best, but this forum doesn't have a working bb [code]..
Lets see, 1,3,5,6,13 those are about it..
C is a lot different then C++, but then again i only have used C as a tool to bind a low function assembler program to a user interface.
_________________ DS Discordion
|
-Shadowalker-™ Admiral Galactic Navy
Joined: September 23, 2007 Posts: 709 From: Shadows
| Posted: 2012-04-22 23:17  
After programming in C#, which is super clean when you follow these rules
and Objective-c, which is complete bullcrap... even when you follow the rules...
objective-c, stupidest language ever.
yeah, unless i have to, i don't really follow these rules... [ This Message was edited by: -Shadowalker-™ on 2012-04-22 23:20 ]
_________________
|
Ak-47[Elite Assault Rifle] Marshal
Joined: September 17, 2011 Posts: 40
| Posted: 2012-04-23 00:12  
im so glad i gave up programing in high school !!! saved alot on Tylenol's !!!
_________________
|