Click here to Skip to main content
12,398,557 members (58,147 online)

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
memberjschell9-Apr-13 9:05 
GeneralRe: Let's "switch" to Something Else Pin
jibalt10-Apr-13 6:34
memberjibalt10-Apr-13 6:34 
GeneralRe: Let's "switch" to Something Else Pin
jschell10-Apr-13 8:17
memberjschell10-Apr-13 8:17 
GeneralRe: Let's "switch" to Something Else Pin
jibalt25-Apr-13 15:44
memberjibalt25-Apr-13 15:44 
GeneralRe: Let's "switch" to Something Else Pin
NAANsoft9-Apr-13 1:25
memberNAANsoft9-Apr-13 1:25 
GeneralRe: Let's "switch" to Something Else Pin
Rob Grainger9-Apr-13 3:01
memberRob Grainger9-Apr-13 3:01 
GeneralRe: Let's "switch" to Something Else Pin
NAANsoft9-Apr-13 4:23
memberNAANsoft9-Apr-13 4:23 
GeneralRe: Let's "switch" to Something Else Pin
jschell9-Apr-13 9:03
memberjschell9-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
memberGary Wheeler4-Apr-13 0:47 
GeneralRe: Let's "switch" to Something Else Pin
jibalt5-Apr-13 19:21
memberjibalt5-Apr-13 19:21 
GeneralRe: Let's "switch" to Something Else Pin
Gary Wheeler8-Apr-13 0:11
memberGary Wheeler8-Apr-13 0:11 
GeneralRe: Let's "switch" to Something Else Pin
CodeBubba9-Apr-13 1:52
memberCodeBubba9-Apr-13 1:52 
GeneralRe: Let's "switch" to Something Else Pin
RafagaX9-Apr-13 4:56
memberRafagaX9-Apr-13 4:56 
GeneralRe: Let's "switch" to Something Else Pin
Dan Sutton9-Apr-13 6:34
memberDan Sutton9-Apr-13 6:34 
GeneralRe: Let's "switch" to Something Else Pin
jschell9-Apr-13 9:08
memberjschell9-Apr-13 9:08 
GeneralRe: Let's "switch" to Something Else Pin
Martin081510-Apr-13 1:41
memberMartin081510-Apr-13 1:41 
GeneralThings that make you go WTF... Pin
Gary Wheeler1-Apr-13 1:32
memberGary Wheeler1-Apr-13 1:32 
GeneralRe: Things that make you go WTF... Pin
Matt T Heffron1-Apr-13 8:53
memberMatt T Heffron1-Apr-13 8:53 
GeneralRe: Things that make you go WTF... Pin
Gary Wheeler1-Apr-13 8:59
memberGary Wheeler1-Apr-13 8:59 
GeneralRe: Things that make you go WTF... Pin
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
protectorPete O'Hanlon2-Apr-13 7:17 
GeneralRe: Things that make you go WTF... Pin
Gary Wheeler2-Apr-13 7:25
memberGary Wheeler2-Apr-13 7:25 
GeneralRe: Things that make you go WTF... Pin
patbob2-Apr-13 5:49
memberpatbob2-Apr-13 5:49 
GeneralRe: Things that make you go WTF... Pin
Gary Wheeler2-Apr-13 6:38
memberGary Wheeler2-Apr-13 6:38 
GeneralRe: Things that make you go WTF... Pin
patbob2-Apr-13 8:03
memberpatbob2-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.


Advertise | Privacy | Mobile
Web02 | 2.8.160721.1 | Last Updated 26 Jul 2016
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid