Click here to Skip to main content
15,887,485 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: That may have been a mistake... Pin
Luc Pattyn22-Aug-10 11:50
sitebuilderLuc Pattyn22-Aug-10 11:50 
GeneralRe: That may have been a mistake... Pin
OriginalGriff22-Aug-10 22:00
mveOriginalGriff22-Aug-10 22:00 
GeneralRe: That may have been a mistake... Pin
PIEBALDconsult22-Aug-10 11:55
mvePIEBALDconsult22-Aug-10 11:55 
GeneralRe: That may have been a mistake... Pin
Luc Pattyn22-Aug-10 12:00
sitebuilderLuc Pattyn22-Aug-10 12:00 
GeneralRe: That may have been a mistake... Pin
PIEBALDconsult22-Aug-10 17:48
mvePIEBALDconsult22-Aug-10 17:48 
GeneralRe: That may have been a mistake... Pin
Robert Rohde22-Aug-10 20:49
Robert Rohde22-Aug-10 20:49 
GeneralRe: That may have been a mistake... Pin
OriginalGriff22-Aug-10 21:13
mveOriginalGriff22-Aug-10 21:13 
GeneralRe: That may have been a mistake... Pin
Daniel Grunwald23-Aug-10 11:11
Daniel Grunwald23-Aug-10 11:11 
Robert Rohde wrote:
I think the created IL code behaves similar to a very large if-then-elseif construct. Thus the switch-solution will get slower if you increase the range of supported numbers.


Wrong. IL has a special instruction for switch which the JIT translates into a jump table. Switches of consecutive integer values (so that a table without large holes is possible) don't get slower if you add cases. Switches of strings are implemented using a Dictionary<string, int> and the IL switch instruction on the resulting int.
GeneralRe: That may have been a mistake... Pin
Peter_in_278025-Aug-10 13:24
professionalPeter_in_278025-Aug-10 13:24 
GeneralRe: That may have been a mistake... Pin
OriginalGriff26-Aug-10 0:36
mveOriginalGriff26-Aug-10 0:36 
GeneralString "bitmaps" Pin
Gordon Kushner20-Aug-10 2:32
Gordon Kushner20-Aug-10 2:32 
GeneralRe: String "bitmaps" Pin
PIEBALDconsult20-Aug-10 3:13
mvePIEBALDconsult20-Aug-10 3:13 
GeneralRe: String "bitmaps" Pin
CDP180220-Aug-10 4:32
CDP180220-Aug-10 4:32 
GeneralRe: String "bitmaps" Pin
Gordon Kushner20-Aug-10 5:22
Gordon Kushner20-Aug-10 5:22 
GeneralRe: String "bitmaps" Pin
Richard A. Dalton20-Aug-10 4:39
Richard A. Dalton20-Aug-10 4:39 
GeneralRe: String "bitmaps" Pin
Gordon Kushner20-Aug-10 5:20
Gordon Kushner20-Aug-10 5:20 
GeneralRe: String "bitmaps" Pin
Richard A. Dalton20-Aug-10 5:53
Richard A. Dalton20-Aug-10 5:53 
GeneralRe: String "bitmaps" Pin
Gordon Kushner20-Aug-10 6:13
Gordon Kushner20-Aug-10 6:13 
GeneralRe: String "bitmaps" Pin
Rob Grainger20-Aug-10 5:56
Rob Grainger20-Aug-10 5:56 
GeneralRe: String "bitmaps" Pin
Richard A. Dalton20-Aug-10 6:58
Richard A. Dalton20-Aug-10 6:58 
GeneralRe: String "bitmaps" Pin
Keith Barrow21-Aug-10 23:45
professionalKeith Barrow21-Aug-10 23:45 
GeneralRe: String "bitmaps" Pin
Richard A. Dalton22-Aug-10 12:21
Richard A. Dalton22-Aug-10 12:21 
GeneralRe: String "bitmaps" Pin
Keith Barrow22-Aug-10 12:49
professionalKeith Barrow22-Aug-10 12:49 
GeneralRe: String "bitmaps" Pin
Richard A. Dalton22-Aug-10 23:32
Richard A. Dalton22-Aug-10 23:32 
GeneralRe: String "bitmaps" Pin
T M Gray20-Aug-10 6:15
T M Gray20-Aug-10 6:15 

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.