Aliotroph? Posted January 14, 2014 There's an amusing blog about appearances of source code in movies/TV. One of the entries says it shows some DOOM code displayed in a music video. Since when was Carmack so sloppy with tabs and spacing? Is this from a port or have I just not looked at his old code in too long? 0 Share this post Link to post
Gez Posted January 14, 2014 If Doom's code's sloppiness surprises you, then indeed you haven't looked at it for too long. Here's the code in question. It actually looks fine on the forum, but not necessarily in text editors...// wipegamestate can be set to -1 to force a wipe on the next draw gamestate_t wipegamestate = GS_DEMOSCREEN; extern boolean setsizeneeded; extern int showMessages; void R_ExecuteSetViewSize (void); void D_Display (void) { static boolean viewactivestate = false; static boolean menuactivestate = false; static boolean inhelpscreensstate = false; static boolean fullscreen = false; static gamestate_t oldgamestate = -1; static int borderdrawcount; int nowtime; int tics; int wipestart; int y; boolean done; boolean wipe; boolean redrawsbar; if (nodrawers) return; // for comparative timing / profiling redrawsbar = false; // change the view size if needed if (setsizeneeded) { R_ExecuteSetViewSize (); oldgamestate = -1; // force background redraw borderdrawcount = 3; } // save the current screen if about to wipe if (gamestate != wipegamestate) { wipe = true; wipe_StartScreen(0, 0, SCREENWIDTH, SCREENHEIGHT); } else wipe = false; if (gamestate == GS_LEVEL && gametic) HU_Erase(); 0 Share this post Link to post
Carnevil Posted January 14, 2014 Yeah, different programs handle tabs/spaces differently. There's a good chance that if you're viewing code in an environment other than it was written in, it's not going to look as pristine. Happens to me all the time when I use a diff program to compare source code files with older versions. 0 Share this post Link to post
printz Posted January 14, 2014 Well, I often tend to change my mind on what is better, tabs or spaces, :) I prefer working with tabs, but I know they're poorly standardized. 0 Share this post Link to post
Maes Posted January 14, 2014 Looks like Carmack was a fan of the Allman style at the time :-) 0 Share this post Link to post
Quasar Posted January 14, 2014 The haphazard mixture of tabs and spaces in the original Doom source is almost impossible to work with. For Chocolate Strife we decided to normalize anything we had to touch to a 4-spaces indentation, and eliminate all tabs. 0 Share this post Link to post
Gez Posted January 14, 2014 Maes said:Looks like Carmack was a fan of the Allman style at the time :-) I like Allman style and Horstmann style; but Stallman style is awful. (Worst is Whitesman, I mean, Whitesmiths style.) 0 Share this post Link to post
Blzut3 Posted January 14, 2014 printz said:Well, I often tend to change my mind on what is better, tabs or spaces, :) I prefer working with tabs, but I know they're poorly standardized. Don't forget the third option of using both! Tabs for indentation, spaces for alignment. Then it doesn't matter what the tab size is set to. Unless you're one of those who insists on breaking lines at the 80 character mark of course. 0 Share this post Link to post
Aliotroph? Posted January 14, 2014 Ahh. I see their editor got confused by the spaces in some of the lines. That is sloppy. The code otherwise looks a lot like much of my recent code because VS enforces Allman style much to the chagrin of Java programmers and people who want to see more lines at a time. (This is a serious consideration for those of us who use 20pt fonts in our editors.) 0 Share this post Link to post
Kirby Posted January 14, 2014 Aliotroph? said:(This is a serious consideration for those of us who use 20pt fonts in our editors.) 20pt font? How frequently? More importantly, how come? 0 Share this post Link to post
Gez Posted January 14, 2014 Kirby said:20pt font? How frequently? More importantly, how come? Eyesight issues I suppose. 0 Share this post Link to post
Aliotroph? Posted January 14, 2014 20pt, bold, light text on dark. Only way I have any chance of seeing my code. It's not even enough anymore since my focal point moved out past the where my retina (yes, just the one) has sufficient resolution. Looking into building a custom monitor stand and then mounting an arm on it so my display can literally be in my face and I don't have to learn over my keyboard. Bad eyesight makes me kind of hate IDEs. It's hard to blow up the text in all the little windows most of the time, and in tools where I manage that it's then hard to fit it on the screen. They're better when the windows can be undocked an the non-code ones can live on my other monitor. 0 Share this post Link to post
Belial Posted January 15, 2014 Gez said:I like Allman style and Horstmann style; but Stallman style is awful. (Worst is Whitesman, I mean, Whitesmiths style.) So Allman style is what I've been using all this time. Can finally put a name on it :P 0 Share this post Link to post