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

 
GeneralWhat did he want to lock? Pin
Tsuda Kageyu8-Jun-10 18:53
Tsuda Kageyu8-Jun-10 18:53 
GeneralRe: What did he want to lock? Pin
leppie8-Jun-10 19:53
leppie8-Jun-10 19:53 
GeneralRe: What did he want to lock? Pin
Stanciu Vlad9-Jun-10 3:17
Stanciu Vlad9-Jun-10 3:17 
GeneralRe: What did he want to lock? Pin
Jeroen De Dauw9-Jun-10 4:56
Jeroen De Dauw9-Jun-10 4:56 
GeneralRe: What did he want to lock? Pin
Andrew Rissing9-Jun-10 4:12
Andrew Rissing9-Jun-10 4:12 
GeneralRe: What did he want to lock? Pin
NavnathKale9-Jun-10 8:24
NavnathKale9-Jun-10 8:24 
GeneralRe: What did he want to lock? Pin
David Skelly9-Jun-10 22:37
David Skelly9-Jun-10 22:37 
GeneralRe: What did he want to lock? Pin
Daniel Grunwald10-Jun-10 6:58
Daniel Grunwald10-Jun-10 6:58 
lock doesn't care whether it's an instance or local variable. It's locking the object, not the variable.

As strings with the same content might or might not be shared by the .NET runtime (depending on how the strings were created, .NET version, compilation options, etc.), no one can ever know what exactly that code was locking. But even if that originally was an instance variable, the original code would have been incorrect.

David Skelly wrote:


It's also possible, of course, that whoever wrote it just didn't understand lock.


That's the only possible explanation.
GeneralRe: What did he want to lock? Pin
supercat910-Jun-10 8:52
supercat910-Jun-10 8:52 
GeneralRe: What did he want to lock? Pin
Gary R. Wheeler13-Jun-10 11:41
Gary R. Wheeler13-Jun-10 11:41 
GeneralRe: What did he want to lock? Pin
supercat914-Jun-10 6:08
supercat914-Jun-10 6:08 
GeneralRe: What did he want to lock? Pin
Gary R. Wheeler14-Jun-10 13:51
Gary R. Wheeler14-Jun-10 13:51 
GeneralRe: What did he want to lock? Pin
supercat915-Jun-10 5:47
supercat915-Jun-10 5:47 
GeneralRe: What did he want to lock? Pin
peterchen10-Jun-10 3:26
peterchen10-Jun-10 3:26 
GeneralRe: What did he want to lock? Pin
bougiefever14-Jun-10 11:19
bougiefever14-Jun-10 11:19 
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 
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 

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.