Click here to Skip to main content

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, embarrasing 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 Pinmemberjschell9-Apr-13 10:05 
GeneralRe: Let's "switch" to Something Else Pinmemberjibalt10-Apr-13 7:34 
GeneralRe: Let's "switch" to Something Else Pinmemberjschell10-Apr-13 9:17 
GeneralRe: Let's "switch" to Something Else Pinmemberjibalt25-Apr-13 16:44 
GeneralRe: Let's "switch" to Something Else PinmemberNAANsoft9-Apr-13 2:25 
GeneralRe: Let's "switch" to Something Else PinmemberRob Grainger9-Apr-13 4:01 
GeneralRe: Let's "switch" to Something Else PinmemberNAANsoft9-Apr-13 5:23 
GeneralRe: Let's "switch" to Something Else Pinmemberjschell9-Apr-13 10: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 PinmemberGary Wheeler4-Apr-13 1:47 
GeneralRe: Let's "switch" to Something Else Pinmemberjibalt5-Apr-13 20:21 
GeneralRe: Let's "switch" to Something Else PinmemberGary Wheeler8-Apr-13 1:11 
GeneralRe: Let's "switch" to Something Else PinmemberCodeBubba9-Apr-13 2:52 
GeneralRe: Let's "switch" to Something Else PinmemberRafagaX9-Apr-13 5:56 
GeneralRe: Let's "switch" to Something Else PinmemberDan Sutton9-Apr-13 7:34 
GeneralRe: Let's "switch" to Something Else Pinmemberjschell9-Apr-13 10:08 
GeneralRe: Let's "switch" to Something Else PinmemberMartin081510-Apr-13 2:41 
GeneralThings that make you go WTF... PinmemberGary Wheeler1-Apr-13 2:32 
GeneralRe: Things that make you go WTF... PinmemberMatt T Heffron1-Apr-13 9:53 
GeneralRe: Things that make you go WTF... PinmemberGary Wheeler1-Apr-13 9:59 
GeneralRe: Things that make you go WTF... PinprofessionalBrisingr Aerowing1-Apr-13 10:48 
GeneralRe: Things that make you go WTF... PinprotectorPete O'Hanlon2-Apr-13 8:17 
GeneralRe: Things that make you go WTF... PinmemberGary Wheeler2-Apr-13 8:25 
GeneralRe: Things that make you go WTF... [modified] Pinmemberpatbob2-Apr-13 6:49 
GeneralRe: Things that make you go WTF... PinmemberGary Wheeler2-Apr-13 7:38 
GeneralRe: Things that make you go WTF... Pinmemberpatbob2-Apr-13 9:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    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
Web03 | 2.8.150414.1 | Last Updated 21 Apr 2015
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid