Click here to Skip to main content
15,911,531 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: MFC Dailog IDD Pin
murali_utr18-Oct-03 0:49
murali_utr18-Oct-03 0:49 
GeneralMicrosoft Access Driver Pin
OTVAC30517-Oct-03 23:19
OTVAC30517-Oct-03 23:19 
GeneralRe: Microsoft Access Driver Pin
Alexander M.,18-Oct-03 12:43
Alexander M.,18-Oct-03 12:43 
GeneralPoints and CRect Pin
Rafael Fernández López17-Oct-03 22:30
Rafael Fernández López17-Oct-03 22:30 
GeneralRe: Points and CRect Pin
Neville Franks17-Oct-03 23:18
Neville Franks17-Oct-03 23:18 
GeneralRe: Points and CRect Pin
Rafael Fernández López17-Oct-03 23:21
Rafael Fernández López17-Oct-03 23:21 
GeneralShallow copy Pin
bhangie17-Oct-03 21:28
bhangie17-Oct-03 21:28 
GeneralRe: Shallow copy Pin
Taka Muraoka17-Oct-03 22:32
Taka Muraoka17-Oct-03 22:32 
Say you have a structure that looks like this:

struct 
{
    int x ; 
    char* p ; 
} ;


If you copy an instance of this structure, the int will copy fine since it is a simple data type but the char* pointer causes problems.

If you just copy the value of p over (a shallow copy), you will have two instances of your structure that have a pointer to the same string. This causes problems when cleaning up - who has responsibility for free'ing the string? You don't want to do it twice.

A deep copy does an intelligent copy - it will make copies of the structure's data members where necessary. In this case, it will allocate a new block of memory and copy the string data over.




"Sucks less" isn't progress - Kent Beck [^]

Awasu 1.1.3 [^]: A free RSS reader with support for Code Project.

GeneralRe: Shallow copy Pin
Johann Gerell17-Oct-03 23:10
Johann Gerell17-Oct-03 23:10 
GeneralAdvice Required Pin
Ajit Jagannath17-Oct-03 20:24
Ajit Jagannath17-Oct-03 20:24 
GeneralRe: Advice Required Pin
Taka Muraoka17-Oct-03 22:17
Taka Muraoka17-Oct-03 22:17 
GeneralRe: Advice Required Pin
Ajit Jagannath18-Oct-03 2:57
Ajit Jagannath18-Oct-03 2:57 
GeneralRe: Advice Required Pin
Taka Muraoka18-Oct-03 5:35
Taka Muraoka18-Oct-03 5:35 
Questionhow to use.... Pin
Member 64882817-Oct-03 19:57
Member 64882817-Oct-03 19:57 
AnswerRe: how to use.... Pin
Dominik Reichl17-Oct-03 22:13
Dominik Reichl17-Oct-03 22:13 
QuestionHow to load a bitmap over a button? Pin
Boby.George17-Oct-03 18:37
professionalBoby.George17-Oct-03 18:37 
AnswerRe: How to load a bitmap over a button? Pin
Ertanto17-Oct-03 21:07
Ertanto17-Oct-03 21:07 
AnswerRe: How to load a bitmap over a button? Pin
Rafael Fernández López17-Oct-03 23:14
Rafael Fernández López17-Oct-03 23:14 
AnswerRe: How to load a bitmap over a button? Pin
far_noor18-Oct-03 2:08
far_noor18-Oct-03 2:08 
GeneralDetecting mouse/KB events on another Application Pin
Zee man17-Oct-03 18:30
Zee man17-Oct-03 18:30 
GeneralRe: Detecting mouse/KB events on another Application Pin
Hosam Aly Mahmoud17-Oct-03 18:56
Hosam Aly Mahmoud17-Oct-03 18:56 
GeneralArabic text search Pin
sinanswedani17-Oct-03 18:15
sinanswedani17-Oct-03 18:15 
GeneralThreadID values. Pin
John M. Drescher17-Oct-03 18:13
John M. Drescher17-Oct-03 18:13 
GeneralRe: ThreadID values. Pin
Michael Dunn17-Oct-03 18:30
sitebuilderMichael Dunn17-Oct-03 18:30 
GeneralRe: ThreadID values. Pin
Xiangyang Liu 刘向阳18-Oct-03 9:27
Xiangyang Liu 刘向阳18-Oct-03 9:27 

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.