Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

How to program in C

Name: Anonymous 2007-04-14 5:24 ID:OOhfheQR

How to program in "C"

1] Use lots of global variables.
2] Give them cryptic names such as: X27, a_gcl, or Horace.
3] Put everything in one large .h file.
4] Implement the entire project at once.
5] Use macros and #defines to emulate Pascal.
6] Assume the compiler takes care of all the little details you didn't quite understand.

"It's 5:50 a.m., Do you know where your stack pointer is?"

[ No, and my program doesn't, either! ]

How to debug a "C" program.

1] If at all possible, don't. Let someone else do it.
2] Change majors.
3] Insert/remove blank lines at random spots, re-compile, and excecute.
4] Throw holy water on the terminal.
5] Dial 911 and scream.
6] There is rumour that "printf" is useful, but this is probably unfounded.
7] Port everything to CP/M.
8] If it still doesn't work, re-write it in assembler. This won't fix the bug, but it will make sure no one else finds it and makes you look bad.
The recent submission of "How to program in C" left out some very important rules.

I have come up with the following list of additional rules in order to give the serious student some aid and the professional a refresher.

How to program in 'C' - addendum

1] Rewrite standard functions and give them your own obscure names.
2] Use obscure, proprietary, non-portable, compiled library packages so that you never have to move from the platform you love so well.
3] Use very descriptive comments like /* printf("Hello world\n"); */ before each function call.
4] REMEMBER - Carriage returns are for weenies. Tabs are for those who have not reached weenie-dom yet.
5] Include LOTS of inline assembly code.
6] "User Interfaces" are for morons. "Users" have no business interfacing with a professional product like yours.
7] If you are forced to comment your code (in English), then borrow comments from somebody else's code and sprinkle them throughout yours. It's quick, easy, and fun to watch people's expressions as they try to figure it out.
8] Remember to define as many pre-processor symbols as possible in terms of already defined symbols. This is considered 'efficient use of code'.

How to debug a 'C' program - addendum

1] Since you got it to compile, the problem must be in the Other Guys Code.
2] If it's all your code then the problem MUST be in those unreliable Standard Libraries. See '1.' in the previous section.
3] Claim the bug reports are viscious lies meant to tarnish your sterling reputation as a 'C' programmer (well aren't they?). After all, those who wrote the reports couldn't even read your code. How could they possibly know if there was a bug or not?
3.a] If they could read your code, review "How to program in 'C'", above.
4] Claim that there wouldn't be a problem if this stingy Company/School/Wife/etc would spring for a copy of C++.

Name: Anonymous 2007-04-14 6:00 ID:Heaven

best advice i've seen on /prog/. ever.

Name: Anonymous 2007-04-14 6:23 ID:TDvOia4v

WINRAR!

we should request how to write Java code next

Name: Anonymous 2007-04-14 7:30 ID:PrBFC1cR

i lol'd, except at '5] Include LOTS of inline assembly code.' , if portability is not important, it feels nice to optimize code

Name: Anonymous 2007-04-14 7:38 ID:SyQTMKiu

>>4
if portability is not important, it feels nice to waste time randomly micro-optimizing code

fix'd.

Name: Anonymous 2007-04-14 18:09 ID:/nImHk0H

>>1

"It's 5:50 a.m., Do you know where your stack pointer is?"
WIN

Name: Anonymous 2007-04-14 18:47 ID:neRwZcME

- Your variables should be named IO, lO, l0, and so on.
- Beware that C macros can have side effects. Don't avoid macros for this; instead, use them to your benefit.
- Comments should be expressive to be useful. Invent words or use your native language as you need. Examples: /* Performs a frilization */, /* This is like 上曳, but faster */
- Good programmers comment abundantly, at least most lines of code, like this:

printf("Processing...\n"); /* Print processing message */
i++; /* Increment i */
*(unsigned int *) &p->cstr1[j++ + ++k] >>= 1;

Name: Anonymous 2007-04-16 1:13 ID:QEZ5U72d

too fucking bad a variable name cant start with a number. never fear, _1O and _10 are always available (in most namespaces). namespaces? wait...

Name: Anonymous 2007-04-16 2:02 ID:jsaUMlph

IO, lO and l0 are not variables starting with numbers

Name: Anonymous 2007-04-16 10:20 ID:wF8NMkFn

Oh man, this makes me think of the Quake2 source before they cleaned it up..

Name: Anonymous 2009-01-14 13:50

MODERATORS!MODERATORS!MODERATORS!

Name: Anonymous 2009-03-06 9:39


The state to disk   so fuck that   could be coded   in less than   5 simultaneous notes.

Name: Anonymous 2010-12-25 16:19

Name: Sgt.Kabu쵢便kiman酀⏸ 2012-05-29 0:30

Bringing /prog/ back to its people
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy

Don't change these.
Name: Email:
Entire Thread Thread List