Click here to Skip to main content
15,900,461 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: To me this is a coding horror, and to you? Pin
Megidolaon15-Sep-08 20:55
Megidolaon15-Sep-08 20:55 
GeneralRe: To me this is a coding horror, and to you? Pin
geoffs15-Sep-08 21:02
geoffs15-Sep-08 21:02 
GeneralRe: To me this is a coding horror, and to you? Pin
CDP180216-Sep-08 4:39
CDP180216-Sep-08 4:39 
GeneralRe: To me this is a coding horror, and to you? [modified] Pin
geoffs16-Sep-08 4:52
geoffs16-Sep-08 4:52 
GeneralRe: To me this is a coding horror, and to you? Pin
BillW3316-Sep-08 6:02
professionalBillW3316-Sep-08 6:02 
GeneralRe: To me this is a coding horror, and to you? Pin
CDP180216-Sep-08 6:03
CDP180216-Sep-08 6:03 
GeneralRe: To me this is a coding horror, and to you? Pin
geoffs16-Sep-08 6:19
geoffs16-Sep-08 6:19 
GeneralRe: To me this is a coding horror, and to you? Pin
CDP180216-Sep-08 21:53
CDP180216-Sep-08 21:53 
Thanks Smile | :)

In any case, a simple method like

public static bool IsError(int ResultValue)
{
    // 0 = success
    // 1 = some error
    // 2 = serious error
    // 3 = ....
    return ResultValue != 0;
}


will do the trick nicely. Such methods may appear a bit ridiculous as well, but actually the compiler should inline them when optimizing the code. And in cases when the return values represent not only success or failure, but also warnings, correctable errors, critical errors, fatal errors and who knows what else, a method to classify the result is much better than dealing with this redundantly in the code every time it's needed.

A while ago he asked me what he should have printed on my business cards. I said 'Wizard'.

I read books which nobody else understand. Then I do something which nobody understands. After that the computer does something which nobody understands. When asked, I say things about the results which nobody understand. But everybody expects miracles from me on a regular basis. Looks to me like the classical definition of a wizard.

GeneralRe: To me this is a coding horror, and to you? Pin
Kevin McFarlane17-Sep-08 0:24
Kevin McFarlane17-Sep-08 0:24 
GeneralRe: To me this is a coding horror, and to you? Pin
Megidolaon25-Feb-09 22:26
Megidolaon25-Feb-09 22:26 
GeneralRe: To me this is a coding horror, and to you? Pin
Dan Neely16-Sep-08 2:08
Dan Neely16-Sep-08 2:08 
GeneralRe: To me this is a coding horror, and to you? Pin
geoffs16-Sep-08 3:17
geoffs16-Sep-08 3:17 
GeneralRe: To me this is a coding horror, and to you? PinPopular
dojohansen16-Sep-08 2:19
dojohansen16-Sep-08 2:19 
GeneralRe: To me this is a coding horror, and to you? Pin
geoffs16-Sep-08 3:18
geoffs16-Sep-08 3:18 
GeneralRe: To me this is a coding horror, and to you? Pin
geoffs19-Sep-08 5:39
geoffs19-Sep-08 5:39 
GeneralRe: To me this is a coding horror, and to you? Pin
Dan Neely19-Sep-08 7:02
Dan Neely19-Sep-08 7:02 
GeneralRe: To me this is a coding horror, and to you? Pin
dojohansen1-Oct-08 3:06
dojohansen1-Oct-08 3:06 
GeneralRe: To me this is a coding horror, and to you? Pin
Dan Neely1-Oct-08 3:16
Dan Neely1-Oct-08 3:16 
GeneralRe: To me this is a coding horror, and to you? Pin
dojohansen1-Oct-08 3:46
dojohansen1-Oct-08 3:46 
GeneralRe: To me this is a coding horror, and to you? Pin
Dan Neely1-Oct-08 4:31
Dan Neely1-Oct-08 4:31 
GeneralRe: To me this is a coding horror, and to you? Pin
Member 41978341-Oct-08 1:01
Member 41978341-Oct-08 1:01 
GeneralRe: To me this is a coding horror, and to you? Pin
cpkilekofp25-Sep-08 3:28
cpkilekofp25-Sep-08 3:28 
GeneralRe: To me this is a coding horror, and to you? Pin
Eslam Afifi15-Sep-08 21:01
Eslam Afifi15-Sep-08 21:01 
GeneralRe: To me this is a coding horror, and to you? Pin
geoffs15-Sep-08 21:10
geoffs15-Sep-08 21:10 
GeneralRe: To me this is a coding horror, and to you? Pin
Eslam Afifi15-Sep-08 21:16
Eslam Afifi15-Sep-08 21:16 

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.