Click here to Skip to main content
15,353,547 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.

 
RantGetAssemblyVersion, VB style Pin
Saša Ćetković27-Jun-22 3:03
professionalSaša Ćetković27-Jun-22 3:03 
General"This is a rare event" PinPopular
Marc Clifton7-May-22 8:33
mvaMarc Clifton7-May-22 8:33 
GeneralRe: "This is a rare event" Pin
Slacker00710-May-22 10:04
professionalSlacker00710-May-22 10:04 
GeneralRe: "This is a rare event" Pin
jsc4211-May-22 0:17
professionaljsc4211-May-22 0:17 
GeneralRe: "This is a rare event" Pin
MarkTJohnson11-May-22 3:23
professionalMarkTJohnson11-May-22 3:23 
GeneralRe: "This is a rare event" Pin
PIEBALDconsult14-May-22 14:20
professionalPIEBALDconsult14-May-22 14:20 
GeneralRe: "This is a rare event" Pin
PIEBALDconsult14-May-22 14:24
professionalPIEBALDconsult14-May-22 14:24 
GeneralRe: "This is a rare event" Pin
Marc Clifton15-May-22 7:04
mvaMarc Clifton15-May-22 7:04 
GeneralRe: "This is a rare event" Pin
Jörgen Andersson17-May-22 23:52
professionalJörgen Andersson17-May-22 23:52 
GeneralRe: "This is a rare event" Pin
Craig Robbins27-Jun-22 14:01
MemberCraig Robbins27-Jun-22 14:01 
GeneralRe: "This is a rare event" Pin
PIEBALDconsult27-Jun-22 14:41
professionalPIEBALDconsult27-Jun-22 14:41 
GeneralRe: "This is a rare event" Pin
Duncan Edwards Jones16-May-22 7:05
professionalDuncan Edwards Jones16-May-22 7:05 
GeneralRe: "This is a rare event" Pin
pkfox12hrs 30mins ago
professionalpkfox12hrs 30mins ago 
GeneralTell me what's wrong with the following Pin
Gary R. Wheeler4-May-22 5:35
MemberGary R. Wheeler4-May-22 5:35 
GeneralRe: Tell me what's wrong with the following Pin
Greg Utas4-May-22 6:42
mveGreg Utas4-May-22 6:42 
GeneralRe: Tell me what's wrong with the following Pin
Gary R. Wheeler4-May-22 6:53
MemberGary R. Wheeler4-May-22 6:53 
GeneralRe: Tell me what's wrong with the following Pin
Greg Utas4-May-22 7:00
mveGreg Utas4-May-22 7:00 
GeneralRe: Tell me what's wrong with the following Pin
Gary R. Wheeler4-May-22 12:30
MemberGary R. Wheeler4-May-22 12:30 
GeneralRe: Tell me what's wrong with the following Pin
Mircea Neacsu4-May-22 9:09
mvaMircea Neacsu4-May-22 9:09 
GeneralRe: Tell me what's wrong with the following Pin
Greg Utas4-May-22 10:09
mveGreg Utas4-May-22 10:09 
GeneralRe: Tell me what's wrong with the following Pin
Randor 4-May-22 10:44
professional Randor 4-May-22 10:44 
GeneralRe: Tell me what's wrong with the following Pin
Greg Utas4-May-22 11:38
mveGreg Utas4-May-22 11:38 
GeneralRe: Tell me what's wrong with the following Pin
Randor 4-May-22 11:49
professional Randor 4-May-22 11:49 
GeneralRe: Tell me what's wrong with the following Pin
Gary R. Wheeler4-May-22 12:33
MemberGary R. Wheeler4-May-22 12:33 
GeneralRe: Tell me what's wrong with the following Pin
Gary R. Wheeler4-May-22 12:48
MemberGary R. Wheeler4-May-22 12:48 
Mircea Neacsu wrote:
The unsigned long of 1 bit?
An unsigned value 1 bit in width is slightly more useful than a signed value 1 bit in width, if you think about it.
Mircea Neacsu wrote:
The SendBlock doubly defined?
That's the error I was referring to. IMO the compiler should issue an error, since the identifier SendBlock is ambiguous when referencing fields in the struct. This code is compiled using VS2008 which does not issue a diagnostic.
Mircea Neacsu wrote:
The version union with members in wrong order?
They're in the correct order. The Message value must be at the end of the structure, since it is a placeholder for the beginning of the variable-length data that's included in the message.
Mircea Neacsu wrote:
The complete lack of comments?
This is a code fragment, extracted from a header file that provides more context.
Mircea Neacsu wrote:
hope they pay you well to put up with this pile of manure WTF | :WTF:
They do pay me well, in the coin that really matters: appreciation. I've worked for the same company for over 30 years, and have survived numerous "workforce reduction" actions during the last period of financial instability.

As to its fecal quality, I didn't create this originally but I have maintained it over the last 20 years. This 'weird & wonderful' came up during some refactoring I'm doing while adding a new feature.
Software Zen: delete this;

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.