Click here to Skip to main content
15,914,500 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: virtual function Pin
Stephen Hewitt10-Feb-08 13:51
Stephen Hewitt10-Feb-08 13:51 
GeneralRe: virtual function Pin
George_George10-Feb-08 19:20
George_George10-Feb-08 19:20 
Questionhow to assign value of arrary to another one? Pin
gentleguy10-Feb-08 1:38
gentleguy10-Feb-08 1:38 
AnswerRe: how to assign value of arrary to another one? Pin
jeron110-Feb-08 8:21
jeron110-Feb-08 8:21 
GeneralRe: how to assign value of arrary to another one? Pin
gentleguy10-Feb-08 13:34
gentleguy10-Feb-08 13:34 
GeneralRe: how to assign value of arrary to another one? Pin
jeron110-Feb-08 15:30
jeron110-Feb-08 15:30 
GeneralRe: how to assign value of arrary to another one? Pin
gentleguy10-Feb-08 16:12
gentleguy10-Feb-08 16:12 
GeneralRe: how to assign value of arrary to another one? Pin
jeron111-Feb-08 2:25
jeron111-Feb-08 2:25 
QuestionHow to add Button to Child Window ? Pin
tina->newcoder10-Feb-08 1:17
tina->newcoder10-Feb-08 1:17 
GeneralRe: How to add Button to Child Window ? Pin
Hamid_RT10-Feb-08 20:35
Hamid_RT10-Feb-08 20:35 
QuestionRe: How to add Button to Child Window ? Pin
David Crow11-Feb-08 3:31
David Crow11-Feb-08 3:31 
GeneralRe: How to add Button to Child Window ? Pin
tina->newcoder11-Feb-08 5:40
tina->newcoder11-Feb-08 5:40 
QuestionRe: How to add Button to Child Window ? Pin
David Crow11-Feb-08 5:45
David Crow11-Feb-08 5:45 
GeneralRe: How to add Button to Child Window ? Pin
tina->newcoder11-Feb-08 6:01
tina->newcoder11-Feb-08 6:01 
QuestionRe: How to add Button to Child Window ? Pin
David Crow11-Feb-08 6:09
David Crow11-Feb-08 6:09 
GeneralRe: How to add Button to Child Window ? Pin
tina->newcoder11-Feb-08 6:12
tina->newcoder11-Feb-08 6:12 
GeneralRe: How to add Button to Child Window ? Pin
tina->newcoder11-Feb-08 5:42
tina->newcoder11-Feb-08 5:42 
QuestionRe: How to add Button to Child Window ? Pin
David Crow11-Feb-08 5:47
David Crow11-Feb-08 5:47 
GeneralRe: How to add Button to Child Window ? Pin
tina->newcoder11-Feb-08 6:28
tina->newcoder11-Feb-08 6:28 
QuestionRe: How to add Button to Child Window ? Pin
David Crow11-Feb-08 6:38
David Crow11-Feb-08 6:38 
GeneralRe: How to add Button to Child Window ? Pin
tina->newcoder11-Feb-08 6:49
tina->newcoder11-Feb-08 6:49 
GeneralDllMain implementation Pin
George_George9-Feb-08 23:01
George_George9-Feb-08 23:01 
Generalsmart pointer release Pin
George_George9-Feb-08 22:48
George_George9-Feb-08 22:48 
Hello everyone,


About the release method implementation of smart pointer of COM, there are two approaches below, and approach 1 is preferred is recommended by Inside COM -- should be better.

Anyone know why approach 1 is better than approach 2?

(m_pI is interface pointer to a COM interface of type T, and it is a member variable of the COM smart pointer class)

Approach 1:

void Release()
{
    if (m_pI != NULL)
    {
        T* pOld = m_pI;
        m_pI = NULL;
        pOld->Release();
    }
}


Approach 2:

void Release()
{
    if (m_pI != NULL)
    {
        m_pI -> Release();
        m_pI = NULL;
    }
}



thanks in advance,
George
JokeRe: The Only Way to Approach Smart ... Pin
Chris Meech10-Feb-08 13:02
Chris Meech10-Feb-08 13:02 
GeneralRe: The Only Way to Approach Smart ... Pin
George_George10-Feb-08 19:21
George_George10-Feb-08 19:21 

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.