Click here to Skip to main content
15,900,378 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionQuestion about malloc a struct Pin
Millenia Nova20-Nov-15 16:02
Millenia Nova20-Nov-15 16:02 
AnswerRe: Question about malloc a struct Pin
Jochen Arndt20-Nov-15 21:45
professionalJochen Arndt20-Nov-15 21:45 
Both are correct. sizeof(struct Vector) expands to the size of the type while sizeof(*retVal) expands to the size of the type pointed to by the variable.

The second method should be preferred because it will be always the correct size even when changing the variable type. Imagine that you have another structure with different size. When you now change the type of retVal to that structure, you must also change the type for the first sizeof() but not for the second.
GeneralRe: Question about malloc a struct Pin
Millenia Nova21-Nov-15 21:53
Millenia Nova21-Nov-15 21:53 
GeneralRe: Question about malloc a struct Pin
Jochen Arndt22-Nov-15 0:22
professionalJochen Arndt22-Nov-15 0:22 
PraiseRe: Question about malloc a struct Pin
Millenia Nova22-Nov-15 11:12
Millenia Nova22-Nov-15 11:12 
AnswerRe: Question about malloc a struct Pin
Richard MacCutchan20-Nov-15 21:45
mveRichard MacCutchan20-Nov-15 21:45 
QuestionMFC Printing of multiple views for a single doc Pin
cc.caprani20-Nov-15 2:51
cc.caprani20-Nov-15 2:51 
Question. Pin
Brisingr Aerowing19-Nov-15 18:11
professionalBrisingr Aerowing19-Nov-15 18:11 
AnswerRe: Trying to port libcddb to MSVC, having issues... Pin
Jochen Arndt19-Nov-15 21:05
professionalJochen Arndt19-Nov-15 21:05 
QuestionRe: Trying to port libcddb to MSVC, having issues... Pin
CPallini19-Nov-15 21:24
mveCPallini19-Nov-15 21:24 
AnswerRe: Trying to port libcddb to MSVC, having issues... Pin
Richard MacCutchan19-Nov-15 23:13
mveRichard MacCutchan19-Nov-15 23:13 
GeneralRe: Trying to port libcddb to MSVC, having issues... Pin
Jochen Arndt20-Nov-15 0:14
professionalJochen Arndt20-Nov-15 0:14 
GeneralRe: Trying to port libcddb to MSVC, having issues... Pin
Richard MacCutchan20-Nov-15 0:23
mveRichard MacCutchan20-Nov-15 0:23 
GeneralRe: Trying to port libcddb to MSVC, having issues... Pin
Jochen Arndt20-Nov-15 0:53
professionalJochen Arndt20-Nov-15 0:53 
GeneralRe: Trying to port libcddb to MSVC, having issues... Pin
Richard MacCutchan20-Nov-15 3:02
mveRichard MacCutchan20-Nov-15 3:02 
GeneralRe: Trying to port libcddb to MSVC, having issues... Pin
Jochen Arndt20-Nov-15 3:06
professionalJochen Arndt20-Nov-15 3:06 
GeneralRe: Trying to port libcddb to MSVC, having issues... Pin
Richard MacCutchan20-Nov-15 3:03
mveRichard MacCutchan20-Nov-15 3:03 
QuestionSTL list member function(S) Pin
Amr.Mohammad8719-Nov-15 7:05
Amr.Mohammad8719-Nov-15 7:05 
AnswerRe: STL list member function(S) Pin
Chris Losinger19-Nov-15 7:41
professionalChris Losinger19-Nov-15 7:41 
GeneralRe: STL list member function(S) Pin
Amr.Mohammad8719-Nov-15 12:47
Amr.Mohammad8719-Nov-15 12:47 
GeneralRe: STL list member function(S) Pin
CPallini19-Nov-15 21:26
mveCPallini19-Nov-15 21:26 
QuestionReturning CBitmap* pointer Pin
_Flaviu18-Nov-15 20:15
_Flaviu18-Nov-15 20:15 
SuggestionRe: Returning CBitmap* pointer Pin
Richard MacCutchan18-Nov-15 21:40
mveRichard MacCutchan18-Nov-15 21:40 
GeneralRe: Returning CBitmap* pointer Pin
_Flaviu19-Nov-15 0:20
_Flaviu19-Nov-15 0:20 
GeneralRe: Returning CBitmap* pointer Pin
Richard MacCutchan19-Nov-15 1:43
mveRichard MacCutchan19-Nov-15 1:43 

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.