Archived

This topic is now archived and is closed to further replies.

Promit

is Carmack trying to piss people off?

Recommended Posts

Promit    13246
I was browsing the Quake 2 source the other day, and i found:
  
#if 0
There was some regular comment here. I don''t have the text with me, but it was definitely a comment!
#endif
  
What the hell is the point of that?

Share this post


Link to post
Share on other sites
eldee    122
what would piss you off?
wanting the quake2 source and not being able to get your hands on it?
or finding a comment you didn''t understand?

i think he''s been quite generous with the release of (several) of id''s
top selling games'' source code.


-eldee
;another space monkey;

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
Who knows, maybe he had something temporary there... like:

#if IAmDebugging
//Comments here:
DisplayDebugInfo();
#endif

Then once he was releasnig the sources, he took out all refrences to DisplayDebugInfo and did a search/replace for all IAmDebugging and changed them to a 0 or something.. who the hell knows, and who cares.. he wrote an awesome game/engine, and handed you the source code for free... and you''re complaining about some comment? WTF?

Billy

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
DAMMIT! GET THE MEDIA ON THE PHONE!! THE WAR ON TERRORISM IS OVER, NOW HE NEED TO DECLARE WAR ON COMMENTS!

Share this post


Link to post
Share on other sites
Promit    13246
At least people have a sense of humor. I''m not serious about all that. Some people are way too tense sometimes.

-----------------------------
The sad thing about artificial intelligence is that it lacks artifice and therefore intelligence.

Share this post


Link to post
Share on other sites
Darkor    134
quote:
Original post by CrazedGenius
Frankly, I''m incredibly pissed off!. I mean, of all the nerve. Just who does he think he is??


Lol.

Maybe Carmack was looking for different ways to piss people off, thus the pointless piece of code. He tackled the problem from a different perspective. Just when you thought Q3 code was clean, comments now have added Q3-dependant functionality that requires the preprocessor.

Share this post


Link to post
Share on other sites
Omaha    100
It probably wasn''t even Carmack. Other guys at id got the code ready to ship, I believe. Anyway, who cares if there''s a wise@$$ comment in there? I''m sure all of us have put something similar in our programs at one time or another...

/* handle the errors here
we shouldn''t have any errors, unless the moron
at the keyboard tries to attack his own units */

Share this post


Link to post
Share on other sites
Dragonskin    122
It takes all types...

Err...um...


Anyway, I LIKE comments like that in code. No, it doesn''t really ADD much, but it gives me something to laugh about while I work on figuring other stuff out.

I even do it myself once in a while, especially when I''ve been working on an object loader for the past three hours and I make comments on different pitfalls of the design. It keeps me from pacing all the time....so I only pace SOME of the time.

Share this post


Link to post
Share on other sites
BeerNutts    4400
You should see some of my comments:
  
// 07/29/01 (Friday, damnit, what am I doing? Well, not drinking obviously!)


(from another file)

// NOTE: I should have documented this as I wrote it. I''m lost now - Will


(and again)
// AHHHH, Stars(), the only pure function saved from the Original

// Alpha. See how I used to write code in High School?

// I knew nothing (hardly) of structure, read-ability, or

// Documentation. But, I had ambition! Hell, I hardly

// knew C, coming from Turbo Basic Background, I did alot

// of goto''s! - Will

// NOTE: macro''s were added later. Was hardcoded to 320x200


(finally)
// NOTE: This function is just ugly, try to ignore - Will



I know there are more cryptic comments I have in my code in places, but those are a few I found on short notice.

Share this post


Link to post
Share on other sites
monkeyman    253
I got in trouble last year for writing a function:

void fuckthis()

Another programmer had asked me to help..he needed to pass the address of a C function as a callback, but the function was in a class..luckily, it was a singleton class, so I just made the fuckthis() function call the class''s method, and passed the address of fuckthis() as the callback..

Well, this other programmer felt that it was an appropriate function name, so he left it..months later, the client complained, the ceo went to the other programmer(all HIS code)and the programmer told him that I wrote the function, and the next thing you know I got the blame..

I don''t put ANYTHING close to sarcastic in my (work)code anymore..




"Like all good things, it starts with a monkey.."

Share this post


Link to post
Share on other sites
Dire.Wolf    122
Well a function called fuckthis() is rather different than a comment. First of all its profanity which clients detest most of the time. It also isn''t really witty. Lastly, since it is a function, it forces others to have to write the profanity themselves when they call the function.

Some of my comments while working on my own code:

// a necessary evil

// hack-job 2000

// just 5 more mins...

// I wrote this?

Some comments I added to "inherited" code (from the client):

// always good to know that my predecessor was a monkey

// if you only knew how long it took me to understand this...

// I read it, laughed at it, then totally rewrote it...

(was later changed to)

// I came, I saw, I rewrote it...

// hopefully this is OK. If not, I didn''t write it...

// ...next stop, spaghetti-ville

// unstable function - enter at your own risk

// I laughed when I first read this code but then I realized that I had to fix it...

// ahhh, so this is where the documentation for this code is...

// we do not call delete on wild pointers...

These are actual comments (I maintain a list) that I''ve thrown into my own code or added to "inherited" code.

Some of them don''t sound as funny as they used to. Then again, pretty much everything sounds funny when you''ve only had 4 hrs of sleep.

Regards,


Dire Wolf
www.digitalfiends.com

Share this post


Link to post
Share on other sites
Dredge-Master    175
One of my mates is the network admin for one of the larger IT companies down here (not saying which). Whilst I was helping him on a solaris system, he was also trying to get the old redhat server up and running with a network card for testing. Found out we had to recompile the drivers for the card. Still wouldn''t work.

As he went through the code to find the bug, he found
// Is this supposed to be here?
followed by some code.

He removed it, and it worked perfectly.



Beer - the love catalyst
good ol'' homepage

Share this post


Link to post
Share on other sites
Promit    13246
I found another something by Carmack that is rather curious:
#if 0
//Commented out until H3D pays us the money they owe us
SOme function call here
#endif

who is ''H3D''

-----------------------------
The sad thing about artificial intelligence is that it lacks artifice and therefore intelligence.

Share this post


Link to post
Share on other sites
Eight    122
Maybe Carmack is *so* good that he had to put innocent looking if statements like that in to slow his engine down.

He probably wrote such an optimised version of Quake3 that it would have run on a 486 but the publishers insisted he raise the minimum CPU requirements.

E

Share this post


Link to post
Share on other sites
CheeseGrater    122
quote:
Original post by Promit
I found another something by Carmack that is rather curious:
#if 0
//Commented out until H3D pays us the money they owe us
SOme function call here
#endif

who is ''H3D''



A company that sells 3D glasses for playing games. Quake supports their stuff, but only with a patch. Probably because H3D didn''t pay carmack to add support in time to make RTM.

Share this post


Link to post
Share on other sites
Mark Duffill    156
Some I''ve seen...
  
// Comment, put comments in here later



  
// Don''t know what this line does, but removing it breaks the program



Another programmer also though it would be funny to put a short story in a file I was working on.... I discovered it a few weeks later,.. highlight of the day

Share this post


Link to post
Share on other sites
Dragonskin    122
quote:
Original post by Eight
Maybe Carmack is *so* good that he had to put innocent looking if statements like that in to slow his engine down.

He probably wrote such an optimised version of Quake3 that it would have run on a 486 but the publishers insisted he raise the minimum CPU requirements.

E


Well...

Maybe that would be the case for COMPILING on a 486.....

They are compiler actions, after all....

Share this post


Link to post
Share on other sites
Beer Hunter    712
It's not hard to see why he did it. For one thing, you can have nested comments with that method. You can also change whether the code is commented out or not by changing the 0 to a 1, although that could also be done this way:

//*

//*/

... but that's a bit awkward. The disadvantage with Carmack's method is that you don't get the syntax highlighting to indicate that it's a comment, but I don't think Carmack would need his comments to be highlighted...

Edited by - Beer Hunter on January 10, 2002 5:22:28 PM

Share this post


Link to post
Share on other sites
matrix2113    122
Some of my comments:
  
//I forgot what this does...


//I can''t remember why (or when) I wrote this, but it seems to work...


//I think I saw this in a movie once


//I specifically remember forgetting this


//I think this lack of sleep (and lack of pants) have made me sterile (wouldn''t be the first time)


//I suddenly have a strange mental image of a banana


//mmmmm.....Banana.......


//So sllepy...cant'' thinc.....so veri veri tired....IF I DONT GET SOME SLEEP SOON THEN I''M GOING TO B

(I don''t even remember writing that^)


"I''ve learned something today: It doesn''t matter if you''re white, or if you''re black...the only color that REALLY matters is green"
-Peter Griffin

Share this post


Link to post
Share on other sites
Enjolras    122
Not having looked at the Quake 2 source I write as an ignorant poster.


#ifdef 0
Comment
#endif

Is really the same as

/* comment */

The preprocessor will never expand anything contained inside the ''0''. Some people do this because many compilers give a much saner error message than leaving off a closing */. In particular, they are better about giving the actual line that the comment (in this case) was opened at.

Either that, or Johnny was just showing off

Share this post


Link to post
Share on other sites
Promit    13246
#if 0
the complex cases add new polys on most lines, so dont optimize for keeping them the same
have multiple free span lists to try to get better coherence?
low depth complexity -- 1 to 3 or so

have a sentinal at both ends?
#endif
This was found at quake2\quake2\ref_soft\r_edge.c(39)

#if 0 // commented out until H3D pays us the money they owe us
GL_DrawStereoPattern();
#endif
This was found at quake2\quake2\ref_gl\gl_rmain.c(1329)

Now here is the most shocking thing I have ever seen:
static byte chktbl[1024] = {
0x84, 0x47, 0x51, 0xc1, 0x93, 0x22, 0x21, 0x24, 0x2f, 0x66, 0x60, 0x4d, 0xb0, 0x7c, 0xda,
0x88, 0x54, 0x15,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0xb9, 0x64, 0xef, 0xc4, 0xa5, 0x6c, 0x08, 0x53, 0xc7, 0x00, 0x10,
0x39, 0x4f, 0xdd, 0xe4, 0xb6, 0x19, 0x27, 0xfb, 0xb8, 0xf5, 0x32, 0x73, 0xe5, 0xcb, 0x32
};
This was found quake2\quake2\qcommon\common.c(1255). Can you believe someone would initialize an entire array with 1024 elements in it?

-----------------------------
The sad thing about artificial intelligence is that it lacks artifice and therefore intelligence.

Share this post


Link to post
Share on other sites