Quantity, not quality
-
I found this function in the service I'm having to debug. I've omitted a few hundred lines of the code so that you may more clearly see the control flow.
void ProcessMessage()
{
if ( )
{}
if ( )
{}
if ( )
{}
if ( )
{}
while ( )
{
if ( )
{
continue;
}if ( ) { continue; } if ( ) { continue; } if ( && ) { if ( || ) { if ( ) { } else { } continue; } } if ( ) { continue; } for ( ; ; ) { if ( ) { } if ( ) { if ( ) { } continue; } if ( ) { if ( ) { } continue; } if ( ) { if ( ) { } else { } if ( || || ( && )) { if ( ) { } } else { if ( ) { } } continue; } if ( ) { for ( ; ; ) { if ( ) { continue; } if ( ) { if ( ) { } else { } if ( ) { } break; } else if ( ) { if ( || ) { if ( ) { if ( ) { } } } if ( ) { } else { } continue; } else { if ( ) { } break; }
-
I found this function in the service I'm having to debug. I've omitted a few hundred lines of the code so that you may more clearly see the control flow.
void ProcessMessage()
{
if ( )
{}
if ( )
{}
if ( )
{}
if ( )
{}
while ( )
{
if ( )
{
continue;
}if ( ) { continue; } if ( ) { continue; } if ( && ) { if ( || ) { if ( ) { } else { } continue; } } if ( ) { continue; } for ( ; ; ) { if ( ) { } if ( ) { if ( ) { } continue; } if ( ) { if ( ) { } continue; } if ( ) { if ( ) { } else { } if ( || || ( && )) { if ( ) { } } else { if ( ) { } } continue; } if ( ) { for ( ; ; ) { if ( ) { continue; } if ( ) { if ( ) { } else { } if ( ) { } break; } else if ( ) { if ( || ) { if ( ) { if ( ) { } } } if ( ) { } else { } continue; } else { if ( ) { } break; }
add a couple of gotos and it'll be perfect
-
I found this function in the service I'm having to debug. I've omitted a few hundred lines of the code so that you may more clearly see the control flow.
void ProcessMessage()
{
if ( )
{}
if ( )
{}
if ( )
{}
if ( )
{}
while ( )
{
if ( )
{
continue;
}if ( ) { continue; } if ( ) { continue; } if ( && ) { if ( || ) { if ( ) { } else { } continue; } } if ( ) { continue; } for ( ; ; ) { if ( ) { } if ( ) { if ( ) { } continue; } if ( ) { if ( ) { } continue; } if ( ) { if ( ) { } else { } if ( || || ( && )) { if ( ) { } } else { if ( ) { } } continue; } if ( ) { for ( ; ; ) { if ( ) { continue; } if ( ) { if ( ) { } else { } if ( ) { } break; } else if ( ) { if ( || ) { if ( ) { if ( ) { } } } if ( ) { } else { } continue; } else { if ( ) { } break; }
(In Homers voice)[sobber][drool]Mmmm! Modular![/drool][/slobber]
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced. This message is made of fully recyclable Zeros and Ones
-
I found this function in the service I'm having to debug. I've omitted a few hundred lines of the code so that you may more clearly see the control flow.
void ProcessMessage()
{
if ( )
{}
if ( )
{}
if ( )
{}
if ( )
{}
while ( )
{
if ( )
{
continue;
}if ( ) { continue; } if ( ) { continue; } if ( && ) { if ( || ) { if ( ) { } else { } continue; } } if ( ) { continue; } for ( ; ; ) { if ( ) { } if ( ) { if ( ) { } continue; } if ( ) { if ( ) { } continue; } if ( ) { if ( ) { } else { } if ( || || ( && )) { if ( ) { } } else { if ( ) { } } continue; } if ( ) { for ( ; ; ) { if ( ) { continue; } if ( ) { if ( ) { } else { } if ( ) { } break; } else if ( ) { if ( || ) { if ( ) { if ( ) { } } } if ( ) { } else { } continue; } else { if ( ) { } break; }
Holy Cow Im suprised the debugger didnt have a stack overflow when it saw this!
-
Holy Cow Im suprised the debugger didnt have a stack overflow when it saw this!
I'm more surprised that the debugger didn't miraculously become intelligent and decided to commit sumicide :laugh:
GSoC 2009 student for SMW! --- My little forums: http://code.bn2vs.com --- 70 72 6F 67 72 61 6D 6D 69 6E 67 20 34 20 6C 69 66 65!
-
I found this function in the service I'm having to debug. I've omitted a few hundred lines of the code so that you may more clearly see the control flow.
void ProcessMessage()
{
if ( )
{}
if ( )
{}
if ( )
{}
if ( )
{}
while ( )
{
if ( )
{
continue;
}if ( ) { continue; } if ( ) { continue; } if ( && ) { if ( || ) { if ( ) { } else { } continue; } } if ( ) { continue; } for ( ; ; ) { if ( ) { } if ( ) { if ( ) { } continue; } if ( ) { if ( ) { } continue; } if ( ) { if ( ) { } else { } if ( || || ( && )) { if ( ) { } } else { if ( ) { } } continue; } if ( ) { for ( ; ; ) { if ( ) { continue; } if ( ) { if ( ) { } else { } if ( ) { } break; } else if ( ) { if ( || ) { if ( ) { if ( ) { } } } if ( ) { } else { } continue; } else { if ( ) { } break; }
That looks strangely familiar, did you delete 4 long case statements and about 10 foreach enumerator loops?
------------------------------- Carrier Bags - 21st Century Tumbleweed.
-
I found this function in the service I'm having to debug. I've omitted a few hundred lines of the code so that you may more clearly see the control flow.
void ProcessMessage()
{
if ( )
{}
if ( )
{}
if ( )
{}
if ( )
{}
while ( )
{
if ( )
{
continue;
}if ( ) { continue; } if ( ) { continue; } if ( && ) { if ( || ) { if ( ) { } else { } continue; } } if ( ) { continue; } for ( ; ; ) { if ( ) { } if ( ) { if ( ) { } continue; } if ( ) { if ( ) { } continue; } if ( ) { if ( ) { } else { } if ( || || ( && )) { if ( ) { } } else { if ( ) { } } continue; } if ( ) { for ( ; ; ) { if ( ) { continue; } if ( ) { if ( ) { } else { } if ( ) { } break; } else if ( ) { if ( || ) { if ( ) { if ( ) { } } } if ( ) { } else { } continue; } else { if ( ) { } break; }
OK, what did you replace it with?
-
I found this function in the service I'm having to debug. I've omitted a few hundred lines of the code so that you may more clearly see the control flow.
void ProcessMessage()
{
if ( )
{}
if ( )
{}
if ( )
{}
if ( )
{}
while ( )
{
if ( )
{
continue;
}if ( ) { continue; } if ( ) { continue; } if ( && ) { if ( || ) { if ( ) { } else { } continue; } } if ( ) { continue; } for ( ; ; ) { if ( ) { } if ( ) { if ( ) { } continue; } if ( ) { if ( ) { } continue; } if ( ) { if ( ) { } else { } if ( || || ( && )) { if ( ) { } } else { if ( ) { } } continue; } if ( ) { for ( ; ; ) { if ( ) { continue; } if ( ) { if ( ) { } else { } if ( ) { } break; } else if ( ) { if ( || ) { if ( ) { if ( ) { } } } if ( ) { } else { } continue; } else { if ( ) { } break; }
One quick guess. Was the project manager had a condition of payment on number of lines code?
Vasudevan Deepak Kumar Personal Homepage
Tech Gossips
The woods are lovely, dark and deep, But I have promises to keep, And miles to go before I sleep, And miles to go before I sleep! -
OK, what did you replace it with?
CTRL+A, DELETE. Then start it afresh. That would be a safer start than a buggy restart into the crazy maze.
Vasudevan Deepak Kumar Personal Homepage
Tech Gossips
The woods are lovely, dark and deep, But I have promises to keep, And miles to go before I sleep, And miles to go before I sleep! -
CTRL+A, DELETE. Then start it afresh. That would be a safer start than a buggy restart into the crazy maze.
Vasudevan Deepak Kumar Personal Homepage
Tech Gossips
The woods are lovely, dark and deep, But I have promises to keep, And miles to go before I sleep, And miles to go before I sleep!Right, so what does it look like now?
-
I found this function in the service I'm having to debug. I've omitted a few hundred lines of the code so that you may more clearly see the control flow.
void ProcessMessage()
{
if ( )
{}
if ( )
{}
if ( )
{}
if ( )
{}
while ( )
{
if ( )
{
continue;
}if ( ) { continue; } if ( ) { continue; } if ( && ) { if ( || ) { if ( ) { } else { } continue; } } if ( ) { continue; } for ( ; ; ) { if ( ) { } if ( ) { if ( ) { } continue; } if ( ) { if ( ) { } continue; } if ( ) { if ( ) { } else { } if ( || || ( && )) { if ( ) { } } else { if ( ) { } } continue; } if ( ) { for ( ; ; ) { if ( ) { continue; } if ( ) { if ( ) { } else { } if ( ) { } break; } else if ( ) { if ( || ) { if ( ) { if ( ) { } } } if ( ) { } else { } continue; } else { if ( ) { } break; }
-
I found this function in the service I'm having to debug. I've omitted a few hundred lines of the code so that you may more clearly see the control flow.
void ProcessMessage()
{
if ( )
{}
if ( )
{}
if ( )
{}
if ( )
{}
while ( )
{
if ( )
{
continue;
}if ( ) { continue; } if ( ) { continue; } if ( && ) { if ( || ) { if ( ) { } else { } continue; } } if ( ) { continue; } for ( ; ; ) { if ( ) { } if ( ) { if ( ) { } continue; } if ( ) { if ( ) { } continue; } if ( ) { if ( ) { } else { } if ( || || ( && )) { if ( ) { } } else { if ( ) { } } continue; } if ( ) { for ( ; ; ) { if ( ) { continue; } if ( ) { if ( ) { } else { } if ( ) { } break; } else if ( ) { if ( || ) { if ( ) { if ( ) { } } } if ( ) { } else { } continue; } else { if ( ) { } break; }
That's called
VP
(Vertical Programming). :-DIf the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
OK, what did you replace it with?
Probably nothing. I'm assuming he's doing maintenance code of something he didn't write (he wouldn't be posting here if he had!). Since it's maintenance, most people are reluctant to rewrite code. Especially if the code looks like this. God knows how the rest of the code looks like...
-- Kein Mitleid Für Die Mehrheit
-
Probably nothing. I'm assuming he's doing maintenance code of something he didn't write (he wouldn't be posting here if he had!). Since it's maintenance, most people are reluctant to rewrite code. Especially if the code looks like this. God knows how the rest of the code looks like...
-- Kein Mitleid Für Die Mehrheit
I did eventually decide to move the body of each loop into its own function. Still uglier than I'd like it to be, but yes, I was reluctant to rewrite it, especially when the problem I was trying to fix turned out to be somewhere else.
-
I found this function in the service I'm having to debug. I've omitted a few hundred lines of the code so that you may more clearly see the control flow.
void ProcessMessage()
{
if ( )
{}
if ( )
{}
if ( )
{}
if ( )
{}
while ( )
{
if ( )
{
continue;
}if ( ) { continue; } if ( ) { continue; } if ( && ) { if ( || ) { if ( ) { } else { } continue; } } if ( ) { continue; } for ( ; ; ) { if ( ) { } if ( ) { if ( ) { } continue; } if ( ) { if ( ) { } continue; } if ( ) { if ( ) { } else { } if ( || || ( && )) { if ( ) { } } else { if ( ) { } } continue; } if ( ) { for ( ; ; ) { if ( ) { continue; } if ( ) { if ( ) { } else { } if ( ) { } break; } else if ( ) { if ( || ) { if ( ) { if ( ) { } } } if ( ) { } else { } continue; } else { if ( ) { } break; }
Wow! That literally hurt my eyes. :wtf: Unfortunately I have seen similar code for text processing. You have to keep scrolling back up a hundred lines or so to find out where the value stored in that variable came from and just what the heck it is supposed to be; of course it was probably modified on the way down – loads of fun. :rolleyes:
INTP "Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra