Click here to Skip to main content
15,922,512 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: simple crypt/encrypt Pin
Toni786-Jun-03 14:31
Toni786-Jun-03 14:31 
Generalthanks Pin
balu_pl7-Jun-03 0:28
balu_pl7-Jun-03 0:28 
GeneralRe: simple crypt/encrypt Pin
Dominik Reichl7-Jun-03 1:05
Dominik Reichl7-Jun-03 1:05 
GeneralRe: simple crypt/encrypt Pin
Toni788-Jun-03 9:01
Toni788-Jun-03 9:01 
QuestionWhat different? Pin
Old Gun6-Jun-03 13:53
Old Gun6-Jun-03 13:53 
AnswerRe: What different? Pin
Michael Dunn6-Jun-03 13:57
sitebuilderMichael Dunn6-Jun-03 13:57 
AnswerRe: What different? Pin
Ravi Bhavnani6-Jun-03 15:04
professionalRavi Bhavnani6-Jun-03 15:04 
AnswerRe: What different? Pin
Mike Nordell7-Jun-03 6:20
Mike Nordell7-Jun-03 6:20 
if (pEdit=NULL) is an assignment, always evaluating to false (after setting pEdit to NULL, of course). A nice side effect is that you get a smaller binary in an optimized build since the compiler removes all code within the scope of that if.

if (!pEdit) compares pEdit to 0, and if it doesn't point to a valid object (NULL, the same as zero in C++, is not a valid address for an object) it executes whatever is in the scope of the if.

If you intended to write if (pEdit==NULL), then the observable difference is exaclty nil. In the first case you compare with NULL (while opening up for the kind of typing errors you did in this post), and in the second case you are effectively communicating to the reader of the code "does not point to anything valid".

I've seen some people swear by the style if (NULL==pEdit), even that I personally think that's the most illogical way to express that condition, to not put themselves in the situation of assigning where they intended to only compare (possibly butterfingers or a lack of const ;->).

But in the end it's all up to style.
GeneralOT Pin
Vikram A Punathambekar7-Jun-03 9:48
Vikram A Punathambekar7-Jun-03 9:48 
GeneralRe: What different? Pin
Ravi Bhavnani7-Jun-03 10:31
professionalRavi Bhavnani7-Jun-03 10:31 
GeneralRe: What different? Pin
Mike Nordell7-Jun-03 15:04
Mike Nordell7-Jun-03 15:04 
GeneralRight To Left Writing Pin
Asad Rasheed6-Jun-03 12:25
Asad Rasheed6-Jun-03 12:25 
GeneralSmart Card Inserts & Removes Pin
Fad B6-Jun-03 10:57
Fad B6-Jun-03 10:57 
GeneralWindow Size and position in registry Pin
electronicman_x6-Jun-03 10:11
electronicman_x6-Jun-03 10:11 
GeneralRe: Window Size and position in registry Pin
Miszou6-Jun-03 11:06
Miszou6-Jun-03 11:06 
GeneralRe: Window Size and position in registry Pin
electronicman_x9-Jun-03 11:11
electronicman_x9-Jun-03 11:11 
GeneralRe: Window Size and position in registry Pin
Neville Franks6-Jun-03 12:12
Neville Franks6-Jun-03 12:12 
GeneralRe: Window Size and position in registry Pin
electronicman_x9-Jun-03 11:14
electronicman_x9-Jun-03 11:14 
GeneralRe: Window Size and position in registry Pin
Neville Franks9-Jun-03 11:36
Neville Franks9-Jun-03 11:36 
Question(Non-programming) Virtual Machine Simulator like VMware? Pin
Dominik Reichl6-Jun-03 9:58
Dominik Reichl6-Jun-03 9:58 
AnswerRe: (Non-programming) Virtual Machine Simulator like VMware? Pin
Daniel Turini6-Jun-03 10:05
Daniel Turini6-Jun-03 10:05 
AnswerRe: (Non-programming) Virtual Machine Simulator like VMware? Pin
Mike Nordell7-Jun-03 6:44
Mike Nordell7-Jun-03 6:44 
GeneralRe: (Non-programming) Virtual Machine Simulator like VMware? Pin
Dominik Reichl7-Jun-03 9:36
Dominik Reichl7-Jun-03 9:36 
GeneralClass Wizard Problems Pin
a2k6-Jun-03 8:32
a2k6-Jun-03 8:32 
GeneralRe: Class Wizard Problems Pin
Cambalindo7-Jun-03 10:22
Cambalindo7-Jun-03 10:22 

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.