Click here to Skip to main content
16,016,770 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: dialog Pin
Christian Graus7-Aug-02 13:24
protectorChristian Graus7-Aug-02 13:24 
GeneralRe: dialog Pin
danag7-Aug-02 13:26
danag7-Aug-02 13:26 
GeneralRe: dialog Pin
Christian Graus7-Aug-02 13:44
protectorChristian Graus7-Aug-02 13:44 
QuestionHow to implement Global Pointers ? Pin
oRion7-Aug-02 13:06
oRion7-Aug-02 13:06 
AnswerRe: How to implement Global Pointers ? Pin
Christian Graus7-Aug-02 13:13
protectorChristian Graus7-Aug-02 13:13 
GeneralRe: How to implement Global Pointers ? Pin
Anonymous8-Aug-02 17:59
Anonymous8-Aug-02 17:59 
AnswerRe: How to implement Global Pointers ? Pin
Chris Losinger7-Aug-02 13:14
professionalChris Losinger7-Aug-02 13:14 
AnswerRe: How to implement Global Pointers ? Pin
Todd Smith8-Aug-02 18:35
Todd Smith8-Aug-02 18:35 
Declare a class in global.cpp and make a single instance of that class

class CGlobal
{
private:
    CGlobal()
    {
        myptr = new int[32];
    }

    ~CGlobal()
    {
        delete [] myptr;
    }
};

static CGlobal globalInit;



oRion wrote:
If the new() statement is implemented in the constructor, would this means every class derive from this Base Class, would call new() statement in the constructor? This means redudant memory allocation is done here?

Yes. Just don't derive from the class. That can be prevented by making the constructor private.

The other option is to make a GlobalInit() and GlobalCleanup() function which does your allocations and call it at the beginning of your program.

Todd Smith
GeneralRe: How to implement Global Pointers ? Pin
oRion9-Aug-02 4:43
oRion9-Aug-02 4:43 
GeneralParadox database ... Pin
Hadi Rezaee7-Aug-02 12:55
Hadi Rezaee7-Aug-02 12:55 
GeneralAccess DB Pin
alex.barylski7-Aug-02 12:00
alex.barylski7-Aug-02 12:00 
GeneralRe: Access DB Pin
Tomasz Sowinski7-Aug-02 12:13
Tomasz Sowinski7-Aug-02 12:13 
GeneralRe: Access DB Pin
alex.barylski7-Aug-02 12:30
alex.barylski7-Aug-02 12:30 
GeneralButton size Pin
orcun colak7-Aug-02 11:56
orcun colak7-Aug-02 11:56 
GeneralRe: Button size Pin
Christian Graus7-Aug-02 13:15
protectorChristian Graus7-Aug-02 13:15 
GeneralDeskband compilation weirdness Pin
User 66587-Aug-02 10:36
User 66587-Aug-02 10:36 
GeneralRe: Deskband compilation weirdness Pin
Anonymous7-Aug-02 10:39
Anonymous7-Aug-02 10:39 
GeneralRe: Deskband compilation weirdness Pin
User 66587-Aug-02 10:43
User 66587-Aug-02 10:43 
GeneralRe: Deskband compilation weirdness Pin
Anonymous7-Aug-02 10:50
Anonymous7-Aug-02 10:50 
GeneralRe: Deskband compilation weirdness Pin
Anonymous7-Aug-02 10:55
Anonymous7-Aug-02 10:55 
GeneralRe: Deskband compilation weirdness Pin
Atlantys7-Aug-02 10:48
Atlantys7-Aug-02 10:48 
GeneralRe: Deskband compilation weirdness Pin
Chris Richardson7-Aug-02 11:21
Chris Richardson7-Aug-02 11:21 
QuestionRight way or Wrong way ? Pin
CrazySkydiver7-Aug-02 10:25
CrazySkydiver7-Aug-02 10:25 
AnswerRe: Right way or Wrong way ? Pin
Chris Losinger7-Aug-02 10:41
professionalChris Losinger7-Aug-02 10:41 
GeneralCLongBinary and Afx entry Pin
ns7-Aug-02 10:03
ns7-Aug-02 10:03 

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.