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

 
GeneralFML, Edition 6580 Pin
Wes Jones8-Jun-10 13:56
Wes Jones8-Jun-10 13:56 
GeneralRe: FML, Edition 6580 Pin
Luc Pattyn8-Jun-10 14:33
sitebuilderLuc Pattyn8-Jun-10 14:33 
GeneralRe: FML, Edition 6580 Pin
Wes Jones8-Jun-10 14:58
Wes Jones8-Jun-10 14:58 
GeneralRe: FML, Edition 6580 Pin
Jeroen De Dauw8-Jun-10 19:49
Jeroen De Dauw8-Jun-10 19:49 
Generaluseless... Pin
Noman Aftab6-Jun-10 21:53
Noman Aftab6-Jun-10 21:53 
GeneralRe: useless... Pin
Jeroen De Dauw6-Jun-10 22:55
Jeroen De Dauw6-Jun-10 22:55 
GeneralRe: useless... Pin
J4amieC6-Jun-10 23:44
J4amieC6-Jun-10 23:44 
GeneralRe: useless... Pin
supercat97-Jun-10 6:08
supercat97-Jun-10 6:08 
I wonder if the person is trying to be paranoid-protective about the possibility that a property might return a type which is not a string, but features bidirectional widening conversions? As a hypothetical example, one might have a private string-interning pool. Properties of a class which would normally return string could instead return items from the pool. If the properties returned strings, then setting one such property to another would require generating a new string object and then doing some sort of dictionary lookup to locate the string in the pool. By contrast, if the objects returned intern-pool references, those steps could be eliminated.

One hazard with such an approach is that if such an object were passed to a function that expected something of type object, things would appear to work normally (the string would be extracted when the object was cast to a string) but the object that was kept would be a pool reference. This could cause an entire pool of interned strings to be kept alive even if there were no live references to anything that cared about the pool being a pool (just a reference to something thought to be a string).
GeneralRe: useless... PinPopular
J4amieC7-Jun-10 6:31
J4amieC7-Jun-10 6:31 
GeneralRe: useless... Pin
supercat97-Jun-10 8:52
supercat97-Jun-10 8:52 
GeneralRe: useless... Pin
PIEBALDconsult8-Jun-10 3:21
mvePIEBALDconsult8-Jun-10 3:21 
GeneralRe: useless... Pin
Hired Mind13-Jul-10 10:23
Hired Mind13-Jul-10 10:23 
GeneralWhen you got your numbers, who needs other types Pin
Yusuf3-Jun-10 8:12
Yusuf3-Jun-10 8:12 
GeneralRe: When you got your numbers, who needs other types Pin
Dan Mos3-Jun-10 9:15
Dan Mos3-Jun-10 9:15 
GeneralRe: When you got your numbers, who needs other types Pin
Ian Shlasko3-Jun-10 9:17
Ian Shlasko3-Jun-10 9:17 
GeneralRe: When you got your numbers, who needs other types Pin
Yusuf3-Jun-10 9:50
Yusuf3-Jun-10 9:50 
GeneralRe: When you got your numbers, who needs other types PinPopular
Andrew Rissing3-Jun-10 9:36
Andrew Rissing3-Jun-10 9:36 
GeneralRe: When you got your numbers, who needs other types Pin
DaveyM694-Jun-10 10:43
professionalDaveyM694-Jun-10 10:43 
GeneralRe: When you got your numbers, who needs other types PinPopular
Thomas Krojer3-Jun-10 21:56
Thomas Krojer3-Jun-10 21:56 
GeneralRe: When you got your numbers, who needs other types Pin
_Erik_3-Jun-10 23:56
_Erik_3-Jun-10 23:56 
GeneralRe: When you got your numbers, who needs other types Pin
Jeremy Hutchinson4-Jun-10 9:12
professionalJeremy Hutchinson4-Jun-10 9:12 
GeneralRe: When you got your numbers, who needs other types Pin
Yusuf4-Jun-10 10:45
Yusuf4-Jun-10 10:45 
GeneralSize Matters Take Two Pin
Paul Hooper27-May-10 3:19
Paul Hooper27-May-10 3:19 
GeneralRe: Size Matters Take Two Pin
ricmil4227-May-10 5:24
ricmil4227-May-10 5:24 
GeneralRe: Size Matters Take Two Pin
CDP180228-May-10 2:43
CDP180228-May-10 2:43 

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.