Click here to Skip to main content
15,886,199 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Reading a text file from a remote machine in LAN using c, c++, vc++ Pin
CPallini28-May-20 10:08
mveCPallini28-May-20 10:08 
QuestionGet expanded macros from precompiler and insert as comments in source code? Pin
arnold_w27-May-20 20:14
arnold_w27-May-20 20:14 
AnswerRe: Get expanded macros from precompiler and insert as comments in source code? Pin
Richard MacCutchan27-May-20 22:44
mveRichard MacCutchan27-May-20 22:44 
GeneralRe: Get expanded macros from precompiler and insert as comments in source code? Pin
arnold_w27-May-20 23:23
arnold_w27-May-20 23:23 
GeneralRe: Get expanded macros from precompiler and insert as comments in source code? Pin
Richard MacCutchan27-May-20 23:34
mveRichard MacCutchan27-May-20 23:34 
QuestionHow to mount an ISO file with disc type - CD/DVD Pin
Member 1001484126-May-20 5:04
Member 1001484126-May-20 5:04 
AnswerRe: How to mount an ISO file with disc type - CD/DVD Pin
jeron126-May-20 5:21
jeron126-May-20 5:21 
QuestionProblem with pointers memory allocation on the same memory area Pin
Member 959508024-May-20 20:37
Member 959508024-May-20 20:37 
Hello,

We use a third party library for our grids. Each grid cell has a style, one member of which is the font:
C++
class CLibStyle
{
	[...]
	CLibFont m_pFont;
	[...]
};

During deserialization serialization in the library methods, the font is managed as follows:
C++
ar >> m_pFont;

For our part, we deserialize the styles line by line, column by column, then storing them in a map to use them later:
C++
CLibStyle * pStyle = NULL;
for (int nNumRow = 0; nNumRow ++; nNumRow <nNbRow)
	for (int nNumCol = 0; nNumCol ++; nNumCol <nNbCol)
	{
		pStyle = new CLibStyle();
		pStyle->Serialize(ar);
		mapStyle->AddTail(pStyle);
	}

So far it's very basic but this is where we have a big problem because it happens that this deserialization, as simple as it is, allocates pointers m_pFont on the same memory areas from one loop to another. With the same archive file, this problem does not necessarily arise depending on whether you are in Debug or in Release, or even differs from one PC to another. Unsure | :~

Afterwards, we inevitably have problems even if the pointers are destroyed ...

Any ideas for ensuring that pointers are not allocated on the same memory range?

Thanks a lot for your help.

modified 25-May-20 3:49am.

AnswerRe: Problem with pointers memory allocation on the same memory area Pin
Stephane Capo24-May-20 21:19
professionalStephane Capo24-May-20 21:19 
GeneralRe: Problem with pointers memory allocation on the same memory area Pin
Richard MacCutchan24-May-20 21:29
mveRichard MacCutchan24-May-20 21:29 
AnswerRe: Problem with pointers memory allocation on the same memory area Pin
Richard MacCutchan24-May-20 21:25
mveRichard MacCutchan24-May-20 21:25 
GeneralRe: Problem with pointers memory allocation on the same memory area Pin
Member 959508024-May-20 21:52
Member 959508024-May-20 21:52 
AnswerRe: Problem with pointers memory allocation on the same memory area Pin
Member 959508024-May-20 22:40
Member 959508024-May-20 22:40 
GeneralRe: Problem with pointers memory allocation on the same memory area Pin
Richard MacCutchan24-May-20 22:54
mveRichard MacCutchan24-May-20 22:54 
GeneralRe: Problem with pointers memory allocation on the same memory area Pin
Member 959508024-May-20 23:03
Member 959508024-May-20 23:03 
GeneralRe: Problem with pointers memory allocation on the same memory area Pin
Richard MacCutchan24-May-20 23:19
mveRichard MacCutchan24-May-20 23:19 
GeneralRe: Problem with pointers memory allocation on the same memory area Pin
Member 95950801-Jun-20 20:36
Member 95950801-Jun-20 20:36 
AnswerRe: Problem with pointers memory allocation on the same memory area Pin
phil.o25-May-20 0:21
professionalphil.o25-May-20 0:21 
GeneralRe: Problem with pointers memory allocation on the same memory area Pin
Richard MacCutchan25-May-20 0:31
mveRichard MacCutchan25-May-20 0:31 
GeneralRe: Problem with pointers memory allocation on the same memory area Pin
Member 959508025-May-20 1:25
Member 959508025-May-20 1:25 
GeneralRe: Problem with pointers memory allocation on the same memory area Pin
phil.o25-May-20 1:36
professionalphil.o25-May-20 1:36 
GeneralRe: Problem with pointers memory allocation on the same memory area Pin
Richard MacCutchan25-May-20 1:46
mveRichard MacCutchan25-May-20 1:46 
AnswerRe: Problem with pointers memory allocation on the same memory area Pin
Member 95950801-Jun-20 20:42
Member 95950801-Jun-20 20:42 
QuestionPrinting With Crystal Report Pin
a_alise21-May-20 11:09
a_alise21-May-20 11:09 
AnswerRe: Printing With Crystal Report Pin
_Flaviu22-May-20 0:12
_Flaviu22-May-20 0:12 

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.