Click here to Skip to main content
15,902,938 members

The Weird and The Wonderful

   

The Weird and The Wonderful forum is a place to post Coding Horrors, Worst Practices, and the occasional flash of brilliance.

We all come across code that simply boggles the mind. Lazy kludges, embarrassing mistakes, horrid workarounds and developers just not quite getting it. And then somedays we come across - or write - the truly sublime.

Post your Best, your worst, and your most interesting. But please - no programming questions . This forum is purely for amusement and discussions on code snippets. All actual programming questions will be removed.

 
GeneralRe: Avoid return statement in the middle - horror or not? Pin
coolM18-Dec-08 10:57
coolM18-Dec-08 10:57 
JokeRe: Avoid return statement in the middle - horror or not? Pin
notmasteryet18-Dec-08 12:29
notmasteryet18-Dec-08 12:29 
GeneralRe: Avoid return statement in the middle - horror or not? Pin
PIEBALDconsult18-Dec-08 15:47
mvePIEBALDconsult18-Dec-08 15:47 
GeneralRe: Avoid return statement in the middle - horror or not? Pin
Megidolaon22-Feb-09 23:43
Megidolaon22-Feb-09 23:43 
GeneralC and Machine Code horror Pin
Timothy Baldwin2-Dec-08 11:12
Timothy Baldwin2-Dec-08 11:12 
GeneralRe: C and Machine Code horror Pin
Paul Conrad2-Dec-08 11:16
professionalPaul Conrad2-Dec-08 11:16 
GeneralRe: C and Machine Code horror Pin
PIEBALDconsult2-Dec-08 13:39
mvePIEBALDconsult2-Dec-08 13:39 
GeneralRe: C and Machine Code horror Pin
supercat95-Dec-08 6:19
supercat95-Dec-08 6:19 
There are cases where I would consider such code appropriate. If the routine in question will represent 90% of the running time of the program in which it resides, writing the routine as indicated will reduce its own running time by 60%, the running time of the program will be significant, and there is no other practical way to achieve such a speedup, then such code could be reasonable.

Such code may also be reasonable in cases where one wishes to thwart disassembly. In such cases, one may have to tolerate some messiness in the source to obfuscate the machine code. If obfuscation of the machine code is a bona fide and legitimate goal, the nasty source code may be an acceptable price to pay.

The above code doesn't seem to contain any loops, so it wouldn't have much use as a speedup method. It might be designed to discourage reverse-engineering, though there would be better ways of accomplishing that.
GeneralRe: C and Machine Code horror Pin
Timothy Baldwin8-Dec-08 8:30
Timothy Baldwin8-Dec-08 8:30 
GeneralRe: C and Machine Code horror Pin
supercat98-Dec-08 19:30
supercat98-Dec-08 19:30 
GeneralRe: C and Machine Code horror Pin
Lutosław5-Dec-08 12:11
Lutosław5-Dec-08 12:11 
GeneralC# bool datatype horror [modified] Pin
Shyam Bharath24-Nov-08 5:00
Shyam Bharath24-Nov-08 5:00 
GeneralRe: C# bool datatype horror Pin
PIEBALDconsult24-Nov-08 5:23
mvePIEBALDconsult24-Nov-08 5:23 
GeneralRe: C# bool datatype horror Pin
Shyam Bharath24-Nov-08 5:32
Shyam Bharath24-Nov-08 5:32 
GeneralRe: C# bool datatype horror Pin
Jason Lepack (LeppyR64)24-Nov-08 5:32
Jason Lepack (LeppyR64)24-Nov-08 5:32 
GeneralRe: C# bool datatype horror Pin
Shyam Bharath24-Nov-08 5:37
Shyam Bharath24-Nov-08 5:37 
GeneralRe: C# bool datatype horror Pin
Lutosław25-Nov-08 10:02
Lutosław25-Nov-08 10:02 
GeneralRe: C# bool datatype horror Pin
Shyam Bharath26-Nov-08 0:07
Shyam Bharath26-Nov-08 0:07 
GeneralRe: C# bool datatype horror Pin
ocdogan4-Dec-08 6:41
ocdogan4-Dec-08 6:41 
RantRe: C# bool datatype horror Pin
TJS4u4-Dec-08 22:51
TJS4u4-Dec-08 22:51 
RantSQL trigger fun Pin
ruanr24-Nov-08 1:07
ruanr24-Nov-08 1:07 
GeneralRe: SQL trigger fun Pin
Ashfield24-Nov-08 1:31
Ashfield24-Nov-08 1:31 
GeneralRe: SQL trigger fun Pin
ruanr24-Nov-08 1:37
ruanr24-Nov-08 1:37 
GeneralRe: SQL trigger fun Pin
Ashfield24-Nov-08 1:55
Ashfield24-Nov-08 1:55 
GeneralRe: SQL trigger fun Pin
Le centriste25-Nov-08 3:22
Le centriste25-Nov-08 3:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.