Heh, it's just a really long function definition:
Code:
void cWindow::Init(char BackgroundPath[50], HINSTANCE *hInstance, unsigned int ClassStyles,
unsigned long WindowStyles, unsigned int Width, unsigned int Height, HBRUSH DefaultBrush)
The longest "in-function" code I have is 167:
Code:
if(FAILED(D3DXCreateFont(D3DDevice, 22, 0, FW_NORMAL, 1, false, DEFAULT_CHARSET,
OUT_DEFAULT_PRECIS, ANTIALIASED_QUALITY, DEFAULT_PITCH|FF_DONTCARE, "Arial", &Font)))
(I split them both up here so as not to have ginormous scrolling action going on.
It's really just my personal preference. Once I write the code, I know it works, and if there's little chance of me going back to change it, then I really don't need to be looking at it. And if I do have to, well, I'll just scroll a little. The long lines usually only happen when I'm filling in parameters for a function, or writing the definition for a function.
Code like this (120 characters):
Code:
float Weight = (TERRAIN_HEIGHT / NUM_TEXTURES - abs(Height - ((I + 1.0f) * dT - 1.0f)) / TERRAIN_HEIGHT / NUM_TEXTURES;
Got split up into:
Code:
float dT = TERRAIN_HEIGHT / NUM_TEXTURES;
float dY = Height - ((I + 1.0f) * dT - 1.0f);
if(dY < 0.0f)
dY = dY * -1;
float Weight = (dT - dY) / dT;
Like I said, for function definitions, they'll stay. For longer pieces of code, I'll usually break it down like that. It helps a lot in being able to debug, especially with long math equations or similarly complex code.