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

 
GeneralRe: WTF Name Field Pin
ZaoWuYa10-Mar-09 0:10
ZaoWuYa10-Mar-09 0:10 
GeneralRe: WTF Name Field [modified*2] Pin
Nagy Vilmos9-Mar-09 23:26
professionalNagy Vilmos9-Mar-09 23:26 
GeneralRe: WTF Name Field Pin
Brady Kelly10-Mar-09 0:00
Brady Kelly10-Mar-09 0:00 
GeneralJust amusing... Pin
dybs6-Mar-09 17:46
dybs6-Mar-09 17:46 
GeneralRe: Just amusing... Pin
puromtec19-Mar-09 3:41
puromtec19-Mar-09 3:41 
GeneralRe: Just amusing... Pin
dojohansen10-Mar-09 22:14
dojohansen10-Mar-09 22:14 
GeneralRe: Just amusing... Pin
BadKarma10-Mar-09 23:32
BadKarma10-Mar-09 23:32 
GeneralRe: Just amusing... Pin
supercat911-Mar-09 8:58
supercat911-Mar-09 8:58 
What if z is volatile?

If Z is volatile, then the code would go from being an idiosyncrasy to a horror, since the two reads would not be equivalent but there would be no sequence point to guarantee which would happen first.

In some cases, it's fine to read a volatile variable twice without an intervening sequence point (e.g. using something like while (*mem != *mem); to determine whether a flash chip is busy). If the order in which the reads take place won't matter, then it won't matter if the compiler rearranges them. On the other hand, in an expression like foo = vol + something - vol, the effect on foo if vol changes will be indeterminate. Far better would be something like foo = vol + something; foo -= vol;. Under that scenario, the semantics if vol changes would be clear.
GeneralRe: Just amusing... Pin
dybs11-Mar-09 17:56
dybs11-Mar-09 17:56 
GeneralRe: Just amusing... Pin
Jeremy Tierman10-Mar-09 5:55
Jeremy Tierman10-Mar-09 5:55 
GeneralQuotes of the day: Pin
Brady Kelly26-Feb-09 5:40
Brady Kelly26-Feb-09 5:40 
GeneralRe: Quotes of the day: Pin
Tony Pottier27-Feb-09 5:11
Tony Pottier27-Feb-09 5:11 
GeneralRe: Quotes of the day: Pin
Brady Kelly27-Feb-09 5:33
Brady Kelly27-Feb-09 5:33 
GeneralRe: Quotes of the day: Pin
Jeremy Tierman2-Mar-09 5:19
Jeremy Tierman2-Mar-09 5:19 
GeneralRe: Quotes of the day: Pin
yassir hannoun1-Mar-09 11:27
yassir hannoun1-Mar-09 11:27 
GeneralRe: Quotes of the day: Pin
Megidolaon4-Mar-09 2:00
Megidolaon4-Mar-09 2:00 
GeneralUseless for Pin
Oscar Luis Vera Pérez20-Feb-09 11:31
Oscar Luis Vera Pérez20-Feb-09 11:31 
JokeRe: Useless for PinPopular
BadKarma20-Feb-09 12:13
BadKarma20-Feb-09 12:13 
GeneralRe: Useless for Pin
«_Superman_»20-Feb-09 15:53
professional«_Superman_»20-Feb-09 15:53 
GeneralRe: Useless for Pin
PIEBALDconsult20-Feb-09 16:07
mvePIEBALDconsult20-Feb-09 16:07 
GeneralRe: Useless for Pin
dojohansen10-Mar-09 22:16
dojohansen10-Mar-09 22:16 
GeneralRe: Useless for Pin
PIEBALDconsult20-Feb-09 13:54
mvePIEBALDconsult20-Feb-09 13:54 
GeneralRe: Useless for Pin
Electron Shepherd5-Mar-09 7:29
Electron Shepherd5-Mar-09 7:29 
GeneralRe: Useless for Pin
Luc Pattyn5-Mar-09 8:49
sitebuilderLuc Pattyn5-Mar-09 8:49 
GeneralRe: Useless for Pin
supercat924-Feb-09 9:27
supercat924-Feb-09 9:27 

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.