Click here to Skip to main content
15,912,977 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Dynamically creating CToolBar Pin
Richard MacCutchan30-Jul-21 4:52
mveRichard MacCutchan30-Jul-21 4:52 
QuestionRGB image to CMYK gdi+ Pin
Gopi Nath15-Jul-21 22:25
Gopi Nath15-Jul-21 22:25 
AnswerRe: RGB image to CMYK gdi+ Pin
Richard MacCutchan17-Jul-21 6:15
mveRichard MacCutchan17-Jul-21 6:15 
AnswerRe: RGB image to CMYK gdi+ Pin
RedDk16-Oct-21 8:24
RedDk16-Oct-21 8:24 
QuestionException handler Pin
Drugodrf14-Jul-21 6:39
Drugodrf14-Jul-21 6:39 
AnswerRe: Exception handler Pin
Greg Utas14-Jul-21 9:15
professionalGreg Utas14-Jul-21 9:15 
AnswerRe: Exception handler Pin
SeeSharp214-Jul-21 10:31
SeeSharp214-Jul-21 10:31 
GeneralRe: Exception handler Pin
Drugodrf15-Jul-21 6:15
Drugodrf15-Jul-21 6:15 
GeneralRe: Exception handler Pin
Victor Nijegorodov15-Jul-21 9:25
Victor Nijegorodov15-Jul-21 9:25 
GeneralRe: Exception handler Pin
jschell17-Jul-21 9:38
jschell17-Jul-21 9:38 
GeneralRe: Exception handler Pin
Victor Nijegorodov17-Jul-21 9:51
Victor Nijegorodov17-Jul-21 9:51 
GeneralRe: Exception handler Pin
Richard MacCutchan17-Jul-21 21:08
mveRichard MacCutchan17-Jul-21 21:08 
QuestionC++ Pin
Member 152817338-Jul-21 8:52
Member 152817338-Jul-21 8:52 
AnswerRe: C++ Pin
OriginalGriff8-Jul-21 8:56
mveOriginalGriff8-Jul-21 8:56 
QuestionRe: C++ Pin
David Crow8-Jul-21 12:19
David Crow8-Jul-21 12:19 
AnswerRe: C++ Pin
Richard MacCutchan8-Jul-21 21:10
mveRichard MacCutchan8-Jul-21 21:10 
GeneralRe: C++ Pin
charlieg17-Aug-21 11:38
charlieg17-Aug-21 11:38 
QuestionHelp me to convert all to C++ (stdio.h) Pin
WEI SHEN KOK7-Jul-21 3:47
WEI SHEN KOK7-Jul-21 3:47 
AnswerRe: Help me to convert all to C++ (stdio.h) Pin
Victor Nijegorodov7-Jul-21 4:30
Victor Nijegorodov7-Jul-21 4:30 
AnswerRe: Help me to convert all to C++ (stdio.h) Pin
Dave Kreskowiak7-Jul-21 5:46
mveDave Kreskowiak7-Jul-21 5:46 
AnswerRe: Help me to convert all to C++ (stdio.h) Pin
Maximilien7-Jul-21 9:41
Maximilien7-Jul-21 9:41 
AnswerRe: Help me to convert all to C++ (stdio.h) Pin
Stefan_Lang7-Jul-21 21:16
Stefan_Lang7-Jul-21 21:16 
QuestionBase types and pointer arrays Pin
Richard Andrew x645-Jul-21 18:26
professionalRichard Andrew x645-Jul-21 18:26 
I'm trying to create an array of pointers to a common base class, but each pointer in the array will point to a different derived class instance. This is a 64-bit application.

Here's the critical portion of my code: (Unnecessary detail has been removed.)

Intellisense is warning me that the second pointer assignment (to the second element in the array) will cause a buffer overrun.

It says, "C6386: Buffer overrun while writing to 'this->m_Members': the writable size is 'this->m_MemberCount*8' bytes, but '16' bytes might be written."

I have never come across this warning before, and I wanted to ask the community if there is something obviously wrong with the code that I'm not seeing.

C++
m_MemberCount = 7;

CGsUCharType* m_s_b1 = new CGsUCharType();  // All of these "Type" classes are derived from CGsTypeBase
CGsUCharType* m_s_b2 = new CGsUCharType();
CGsUCharType* m_s_b3 = new CGsUCharType();
CGsUCharType* m_s_b4 = new CGsUCharType();

CGsUShortType* m_s_w1 = new CGsUShortType();
CGsUShortType* m_s_w2 = new CGsUShortType();
CGsULongType* m_S_addr = new CGsULongType();

CGsTypeBase** m_Members = new CGsTypeBase*[m_MemberCount]; // Is this the correct way to create an array of pointers?

m_Members[0] = m_s_b1;
m_Members[1] = m_s_b2; // This line has the warning about the buffer overrun.
m_Members[2] = m_s_b3;
m_Members[3] = m_s_b4;
m_Members[4] = m_s_w1;
m_Members[5] = m_s_w2;
m_Members[6] = m_S_addr;




The difficult we do right away...
...the impossible takes slightly longer.

AnswerRe: Base types and pointer arrays Pin
Daniel Pfeffer5-Jul-21 20:56
professionalDaniel Pfeffer5-Jul-21 20:56 
GeneralRe: Base types and pointer arrays Pin
Richard Andrew x646-Jul-21 3:55
professionalRichard Andrew x646-Jul-21 3:55 

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.