Click here to Skip to main content
15,890,512 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: Let's "switch" to Something Else Pin
jschell9-Apr-13 9:05
jschell9-Apr-13 9:05 
GeneralRe: Let's "switch" to Something Else Pin
jibalt10-Apr-13 6:34
jibalt10-Apr-13 6:34 
GeneralRe: Let's "switch" to Something Else Pin
jschell10-Apr-13 8:17
jschell10-Apr-13 8:17 
GeneralRe: Let's "switch" to Something Else Pin
jibalt25-Apr-13 15:44
jibalt25-Apr-13 15:44 
GeneralRe: Let's "switch" to Something Else Pin
NAANsoft9-Apr-13 1:25
NAANsoft9-Apr-13 1:25 
GeneralRe: Let's "switch" to Something Else Pin
Rob Grainger9-Apr-13 3:01
Rob Grainger9-Apr-13 3:01 
GeneralRe: Let's "switch" to Something Else Pin
NAANsoft9-Apr-13 4:23
NAANsoft9-Apr-13 4:23 
GeneralRe: Let's "switch" to Something Else Pin
jschell9-Apr-13 9:03
jschell9-Apr-13 9:03 
Tom Delany wrote:
event that the code is ever ported to a big-endian system, it would be completely broken.


No it wouldn't.

The code POSTED would work regardless of that.

As mentioned it is a TCP stream so it sequential. The switch statement is using ascii. The only way endianess would matter would be if the stream started to use a different character set. And if it did that it would fail if
1. The character system was not using a 8 bit lower representation of that matched ascii (UTF8 does where UTF16 does not.)
2. AND if the protocol changed.

And certainly if item 2 is true then all sorts of problems could result. Such as the rest of the code, following the switch, failing as well.
GeneralRe: Let's "switch" to Something Else Pin
Gary Wheeler4-Apr-13 0:47
Gary Wheeler4-Apr-13 0:47 
GeneralRe: Let's "switch" to Something Else Pin
jibalt5-Apr-13 19:21
jibalt5-Apr-13 19:21 
GeneralRe: Let's "switch" to Something Else Pin
Gary Wheeler8-Apr-13 0:11
Gary Wheeler8-Apr-13 0:11 
GeneralRe: Let's "switch" to Something Else Pin
ClockMeister9-Apr-13 1:52
professionalClockMeister9-Apr-13 1:52 
GeneralRe: Let's "switch" to Something Else Pin
RafagaX9-Apr-13 4:56
professionalRafagaX9-Apr-13 4:56 
GeneralRe: Let's "switch" to Something Else Pin
Dan Sutton9-Apr-13 6:34
Dan Sutton9-Apr-13 6:34 
GeneralRe: Let's "switch" to Something Else Pin
jschell9-Apr-13 9:08
jschell9-Apr-13 9:08 
GeneralRe: Let's "switch" to Something Else Pin
Martin081510-Apr-13 1:41
professionalMartin081510-Apr-13 1:41 
GeneralThings that make you go WTF... Pin
Gary Wheeler1-Apr-13 1:32
Gary Wheeler1-Apr-13 1:32 
GeneralRe: Things that make you go WTF... Pin
Matt T Heffron1-Apr-13 8:53
professionalMatt T Heffron1-Apr-13 8:53 
GeneralRe: Things that make you go WTF... Pin
Gary Wheeler1-Apr-13 8:59
Gary Wheeler1-Apr-13 8:59 
GeneralRe: Things that make you go WTF... PinPopular
Brisingr Aerowing1-Apr-13 9:48
professionalBrisingr Aerowing1-Apr-13 9:48 
GeneralRe: Things that make you go WTF... Pin
Pete O'Hanlon2-Apr-13 7:17
mvePete O'Hanlon2-Apr-13 7:17 
GeneralRe: Things that make you go WTF... Pin
Gary Wheeler2-Apr-13 7:25
Gary Wheeler2-Apr-13 7:25 
GeneralRe: Things that make you go WTF... Pin
patbob2-Apr-13 5:49
patbob2-Apr-13 5:49 
GeneralRe: Things that make you go WTF... Pin
Gary Wheeler2-Apr-13 6:38
Gary Wheeler2-Apr-13 6:38 
GeneralRe: Things that make you go WTF... Pin
patbob2-Apr-13 8:03
patbob2-Apr-13 8:03 

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.