Click here to Skip to main content
15,889,216 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: true/false statements in if clause Pin
Code-o-mat13-Oct-10 22:05
Code-o-mat13-Oct-10 22:05 
GeneralRe: true/false statements in if clause Pin
Aescleal13-Oct-10 23:06
Aescleal13-Oct-10 23:06 
GeneralRe: true/false statements in if clause Pin
Code-o-mat13-Oct-10 23:15
Code-o-mat13-Oct-10 23:15 
AnswerRe: true/false statements in if clause Pin
Luc Pattyn13-Oct-10 8:31
sitebuilderLuc Pattyn13-Oct-10 8:31 
GeneralRe: true/false statements in if clause Pin
CPallini13-Oct-10 9:19
mveCPallini13-Oct-10 9:19 
GeneralRe: true/false statements in if clause Pin
Niklas L14-Oct-10 2:44
Niklas L14-Oct-10 2:44 
GeneralRe: true/false statements in if clause Pin
PravinSingh14-Oct-10 5:49
PravinSingh14-Oct-10 5:49 
GeneralRe: true/false statements in if clause Pin
Niklas L14-Oct-10 6:33
Niklas L14-Oct-10 6:33 
It's ultra-bad. Returning non-zero on success, might just as well mean returning 2, 3 or, God forbid, even 4. Comparing it to TRUE (i.e. 1) might not give the anticipated result. The only thing you can compare it to is FALSE, if (bDoIt != FALSE), would have been the correct usage. But that really doesn't help anyone, does it.

Good naming removes the need for such constructs. It's about readability.
Consider
if (signalIsOn) {}
if (signalIsOn == true) {}


The second construct is just plain silly, and actually reduces readability.

QuestionRe: true/false statements in if clause Pin
PravinSingh14-Oct-10 21:26
PravinSingh14-Oct-10 21:26 
AnswerRe: true/false statements in if clause Pin
Niklas L15-Oct-10 7:42
Niklas L15-Oct-10 7:42 
AnswerRe: true/false statements in if clause Pin
fjdiewornncalwe13-Oct-10 8:33
professionalfjdiewornncalwe13-Oct-10 8:33 
AnswerRe: true/false statements in if clause Pin
Aescleal13-Oct-10 11:21
Aescleal13-Oct-10 11:21 
QuestionCInternetSession: https certificate problem Pin
msn9213-Oct-10 6:05
msn9213-Oct-10 6:05 
AnswerRe: CInternetSession: https certificate problem Pin
Code-o-mat13-Oct-10 6:19
Code-o-mat13-Oct-10 6:19 
GeneralRe: CInternetSession: https certificate problem Pin
msn9214-Oct-10 4:49
msn9214-Oct-10 4:49 
GeneralRe: CInternetSession: https certificate problem Pin
Code-o-mat14-Oct-10 5:21
Code-o-mat14-Oct-10 5:21 
QuestionRemove Maximize Pin
john563213-Oct-10 5:20
john563213-Oct-10 5:20 
AnswerRe: Remove Maximize Pin
Aescleal13-Oct-10 5:43
Aescleal13-Oct-10 5:43 
GeneralRe: Remove Maximize Pin
Emilio Garavaglia14-Oct-10 4:14
Emilio Garavaglia14-Oct-10 4:14 
AnswerRe: Remove Maximize Pin
Alain Rist13-Oct-10 6:28
Alain Rist13-Oct-10 6:28 
QuestionPainfully frustrating sdk memory exception? [modified] Pin
fjdiewornncalwe13-Oct-10 1:47
professionalfjdiewornncalwe13-Oct-10 1:47 
AnswerRe: Bloody sdk memory exception? Pin
Sauro Viti13-Oct-10 2:33
professionalSauro Viti13-Oct-10 2:33 
GeneralRe: Bloody sdk memory exception? Pin
fjdiewornncalwe13-Oct-10 3:13
professionalfjdiewornncalwe13-Oct-10 3:13 
AnswerRe: Bloody sdk memory exception? Pin
Maximilien13-Oct-10 5:47
Maximilien13-Oct-10 5:47 
GeneralRe: Bloody sdk memory exception? Pin
fjdiewornncalwe13-Oct-10 5:54
professionalfjdiewornncalwe13-Oct-10 5:54 

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.