Click here to Skip to main content
15,887,392 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: Do you not understand booleans? Pin
OriginalGriff9-Dec-11 2:50
mveOriginalGriff9-Dec-11 2:50 
GeneralRe: Do you not understand booleans? Pin
BobJanova9-Dec-11 4:15
BobJanova9-Dec-11 4:15 
JokeRe: Do you not understand booleans? Pin
harold aptroot9-Dec-11 4:27
harold aptroot9-Dec-11 4:27 
GeneralRe: Do you not understand booleans? Pin
Rob Grainger11-Dec-11 23:32
Rob Grainger11-Dec-11 23:32 
GeneralRe: Do you not understand booleans? Pin
CDP180211-Dec-11 23:46
CDP180211-Dec-11 23:46 
GeneralRe: Do you not understand booleans? Pin
BobJanova13-Dec-11 23:41
BobJanova13-Dec-11 23:41 
GeneralRe: Do you not understand booleans? Pin
Kabwla.Phone12-Dec-11 23:48
Kabwla.Phone12-Dec-11 23:48 
GeneralRe: Do you not understand booleans? Pin
Addy Tas13-Dec-11 12:41
Addy Tas13-Dec-11 12:41 
I came from the same dark ages and indeed untill some time ago i also had the tendency to check the boolean value. Particularly the BOOL was a nasty one as you could (with good sense) only check that to FALSE. One other 'trick' i got used to apply was swapping the variable and the value

E.g.
 if(FALSE != flag)
{


Logically this seems a bit odd but then again it did protect me against typo's like:

 if( flag = FALSE)
{


Today this will generate a compiler warning but that has not always been the case and if you have a special vendor type compiler; you may still face the same.

Why check on FALSE? Simple; that was defined (as 0), any one could set the BOOL to TRUE, 1, 2 etc.

Don't you love the compilers of today? Or better yet, those of tomorrow?

Cheers, AT
Cogito ergo sum

GeneralRe: Do you not understand booleans? Pin
PIEBALDconsult9-Dec-11 2:00
mvePIEBALDconsult9-Dec-11 2:00 
GeneralRe: Do you not understand booleans? Pin
CDP18029-Dec-11 2:34
CDP18029-Dec-11 2:34 
GeneralRe: Do you not understand booleans? Pin
harold aptroot9-Dec-11 3:00
harold aptroot9-Dec-11 3:00 
GeneralRe: Do you not understand booleans? Pin
CDP18029-Dec-11 3:33
CDP18029-Dec-11 3:33 
GeneralRe: Do you not understand booleans? Pin
harold aptroot9-Dec-11 3:42
harold aptroot9-Dec-11 3:42 
GeneralRe: Do you not understand booleans? Pin
CDP18029-Dec-11 4:24
CDP18029-Dec-11 4:24 
GeneralRe: Do you not understand booleans? Pin
BobJanova9-Dec-11 4:20
BobJanova9-Dec-11 4:20 
GeneralRe: Do you not understand booleans? Pin
Stefan_Lang12-Dec-11 5:40
Stefan_Lang12-Dec-11 5:40 
GeneralRe: Do you not understand booleans? Pin
Rob Grainger11-Dec-11 23:27
Rob Grainger11-Dec-11 23:27 
GeneralRe: Do you not understand booleans? Pin
Addy Tas13-Dec-11 12:43
Addy Tas13-Dec-11 12:43 
GeneralRe: Do you not understand booleans? Pin
RoelofDeVilliers12-Dec-11 3:15
RoelofDeVilliers12-Dec-11 3:15 
GeneralRe: Do you not understand booleans? Pin
Member 368731912-Dec-11 4:14
Member 368731912-Dec-11 4:14 
GeneralRe: Do you not understand booleans? Pin
BobJanova13-Dec-11 23:37
BobJanova13-Dec-11 23:37 
GeneralRe: Do you not understand booleans? Pin
RoelofDeVilliers18-Dec-11 9:25
RoelofDeVilliers18-Dec-11 9:25 
GeneralRe: Do you not understand booleans? Pin
Jeroen De Dauw10-Dec-11 12:03
Jeroen De Dauw10-Dec-11 12:03 
GeneralRe: Do you not understand booleans? Pin
harold aptroot10-Dec-11 22:53
harold aptroot10-Dec-11 22:53 
GeneralRe: Do you not understand booleans? Pin
Matthew Dennis11-Dec-11 15:41
sysadminMatthew Dennis11-Dec-11 15:41 

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.