Click here to Skip to main content
15,867,308 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: how to typedef array of 4 char to be used in map template my solution CPallini hope you read this thank you Pin
CPallini16-Dec-22 4:38
mveCPallini16-Dec-22 4:38 
GeneralRe: how to typedef array of 4 char to be used in map template my solution CPallini hope you read this thank you Pin
ForNow16-Dec-22 5:11
ForNow16-Dec-22 5:11 
GeneralRe: how to typedef array of 4 char to be used in map template my solution CPallini hope you read this thank you Pin
Richard MacCutchan16-Dec-22 6:26
mveRichard MacCutchan16-Dec-22 6:26 
GeneralRe: how to typedef array of 4 char to be used in map template my solution CPallini hope you read this thank you Pin
CPallini16-Dec-22 6:59
mveCPallini16-Dec-22 6:59 
GeneralRe: how to typedef array of 4 char to be used in map template my solution CPallini hope you read this thank you Pin
ForNow16-Dec-22 7:57
ForNow16-Dec-22 7:57 
QuestionCcmdtarget() assertion and relaise failure Pin
Zouaoui Billel8-Dec-22 9:00
Zouaoui Billel8-Dec-22 9:00 
AnswerRe: Ccmdtarget() assertion and relaise failure Pin
Victor Nijegorodov8-Dec-22 9:43
Victor Nijegorodov8-Dec-22 9:43 
QuestionProper way to put a C++ object inside a struct initialization? Pin
arnold_w5-Dec-22 1:01
arnold_w5-Dec-22 1:01 
I working in an embedded environment (STM32 microcontroller) and I compile using GCC (STM32CubeIDE). I want to put a C++ object inside a struct and this is the only way I could get it to compile:
C++
namespace MyNamespace {
    class MyObject
    {
        int m_i;
public:
        MyObject(int i):m_i(i){}
        MyObject(const MyObject&) = delete;
    };
}

typedef struct {
    MyNamespace::MyObject*  MyObject;
} MyStruct_s;

static MyStruct_s MyStruct = {new MyNamespace::MyObject(0) };
However, I'm having strange hanging issues in my code and I suspect the code above might be the cause. Is the code above legal or will it corrupt RAM? If so, what's the correct way to do it? Ideally I'd like to have the whole object inside the struct, not just a pointer to it.

modified 5-Dec-22 8:23am.

AnswerRe: Proper way to put a C++ object inside a struct initialization? Pin
CPallini5-Dec-22 1:15
mveCPallini5-Dec-22 1:15 
GeneralRe: Proper way to put a C++ object inside a struct initialization? Pin
arnold_w5-Dec-22 2:05
arnold_w5-Dec-22 2:05 
GeneralRe: Proper way to put a C++ object inside a struct initialization? Pin
CPallini5-Dec-22 2:54
mveCPallini5-Dec-22 2:54 
GeneralRe: Proper way to put a C++ object inside a struct initialization? Pin
arnold_w5-Dec-22 3:32
arnold_w5-Dec-22 3:32 
GeneralRe: Proper way to put a C++ object inside a struct initialization? Pin
Mircea Neacsu5-Dec-22 2:54
Mircea Neacsu5-Dec-22 2:54 
GeneralRe: Proper way to put a C++ object inside a struct initialization? Pin
CPallini5-Dec-22 7:44
mveCPallini5-Dec-22 7:44 
AnswerRe: Proper way to put a C++ object inside a struct initialization? Pin
Mircea Neacsu5-Dec-22 1:30
Mircea Neacsu5-Dec-22 1:30 
GeneralRe: Proper way to put a C++ object inside a struct initialization? Pin
arnold_w5-Dec-22 2:07
arnold_w5-Dec-22 2:07 
QuestionMFC. How to display a bitmap or a .png file Pin
BigSteve-O14-Nov-22 8:44
BigSteve-O14-Nov-22 8:44 
QuestionRe: MFC. How to display a bitmap or a .png file Pin
CPallini14-Nov-22 9:25
mveCPallini14-Nov-22 9:25 
AnswerRe: MFC. How to display a bitmap or a .png file Pin
BigSteve-O14-Nov-22 9:57
BigSteve-O14-Nov-22 9:57 
GeneralRe: MFC. How to display a bitmap or a .png file Pin
Victor Nijegorodov14-Nov-22 10:52
Victor Nijegorodov14-Nov-22 10:52 
GeneralRe: MFC. How to display a bitmap or a .png file Pin
BigSteve-O14-Nov-22 11:29
BigSteve-O14-Nov-22 11:29 
QuestionRe: MFC. How to display a bitmap or a .png file Pin
CPallini15-Nov-22 1:58
mveCPallini15-Nov-22 1:58 
AnswerRe: MFC. How to display a bitmap or a .png file Pin
BigSteve-O16-Nov-22 13:45
BigSteve-O16-Nov-22 13:45 
GeneralRe: MFC. How to display a bitmap or a .png file Pin
Victor Nijegorodov16-Nov-22 20:22
Victor Nijegorodov16-Nov-22 20:22 
GeneralRe: MFC. How to display a bitmap or a .png file Pin
Victor Nijegorodov16-Nov-22 20:36
Victor Nijegorodov16-Nov-22 20:36 

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.