Click here to Skip to main content
15,919,245 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: This is just for the laugh of it. Pin
cpkilekofp25-Sep-08 3:16
cpkilekofp25-Sep-08 3:16 
GeneralRe: This is just for the laugh of it. Pin
VentsyV1-Oct-08 11:58
VentsyV1-Oct-08 11:58 
GeneralRe: This is just for the laugh of it. Pin
cpkilekofp2-Oct-08 4:53
cpkilekofp2-Oct-08 4:53 
GeneralRe: This is just for the laugh of it. Pin
KarstenK28-Sep-08 21:15
mveKarstenK28-Sep-08 21:15 
GeneralThe Loop Pin
cigicd17-Sep-08 4:10
cigicd17-Sep-08 4:10 
GeneralRe: The Loop Pin
CPallini17-Sep-08 5:27
mveCPallini17-Sep-08 5:27 
GeneralRe: The Loop Pin
StevenWalsh17-Sep-08 9:25
StevenWalsh17-Sep-08 9:25 
GeneralRe: The Loop Pin
dighn17-Sep-08 9:58
dighn17-Sep-08 9:58 
GeneralOT Pin
CPallini17-Sep-08 10:11
mveCPallini17-Sep-08 10:11 
GeneralRe: The Loop Pin
Joe Woodbury17-Sep-08 11:00
professionalJoe Woodbury17-Sep-08 11:00 
GeneralRe: The Loop Pin
Paul Conrad17-Sep-08 15:33
professionalPaul Conrad17-Sep-08 15:33 
GeneralTo me this is a coding horror, and to you? [modified] Pin
geoffs15-Sep-08 20:35
geoffs15-Sep-08 20:35 
GeneralRe: To me this is a coding horror, and to you? Pin
GDavy15-Sep-08 20:47
GDavy15-Sep-08 20:47 
GeneralRe: To me this is a coding horror, and to you? Pin
geoffs15-Sep-08 20:50
geoffs15-Sep-08 20:50 
GeneralRe: To me this is a coding horror, and to you? Pin
GDavy16-Sep-08 3:23
GDavy16-Sep-08 3:23 
GeneralRe: To me this is a coding horror, and to you? PinPopular
QuiJohn16-Sep-08 4:16
QuiJohn16-Sep-08 4:16 
GeneralRe: To me this is a coding horror, and to you? Pin
geoffs16-Sep-08 4:25
geoffs16-Sep-08 4:25 
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.

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.