Click here to Skip to main content
15,914,013 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: dynamic array sizes Pin
PJ Arends18-Nov-06 7:08
professionalPJ Arends18-Nov-06 7:08 
GeneralRe: dynamic array sizes Pin
Waldermort18-Nov-06 7:14
Waldermort18-Nov-06 7:14 
GeneralRe: dynamic array sizes Pin
PJ Arends18-Nov-06 7:22
professionalPJ Arends18-Nov-06 7:22 
GeneralRe: dynamic array sizes Pin
Waldermort18-Nov-06 7:33
Waldermort18-Nov-06 7:33 
GeneralRe: dynamic array sizes Pin
PJ Arends18-Nov-06 7:38
professionalPJ Arends18-Nov-06 7:38 
GeneralRe: dynamic array sizes Pin
Waldermort18-Nov-06 7:46
Waldermort18-Nov-06 7:46 
AnswerRe: dynamic array sizes Pin
Michael Dunn18-Nov-06 14:00
sitebuilderMichael Dunn18-Nov-06 14:00 
AnswerRe: dynamic array sizes Pin
Christian Graus18-Nov-06 14:15
protectorChristian Graus18-Nov-06 14:15 
WalderMort wrote:
Why is it that C has a whole bunch of other functions like calloc(), realloc() and _msize()? The latter is what pains me today.

C is a pain Smile | :)

WalderMort wrote:
Most of you will say to use a vector,


Yes...

WalderMort wrote:
For example I need to allocate space for a RGNDATA struct which is a little more than a simple array. Allocating the space is no problem, but how is it possible to later find out how much memory was allocated? In C a call to _msize() would do the job, but experience tells me not to mix C and C++ when it comes to memory.

The way that classes like vector do it is to store the size in a variable, I am sure.
WalderMort wrote:
Is there a way to do this other than storing the size when it was allocated?

There are tricks with sizeof that I've seen used, such as sizeof(x)/sizeof(char) for the size of a char array.  But, I'd be inclined to use vector, the address of item [0] is the address of the whole array.  Or, write your own class to handle it.



Christian Graus - C++ MVP

AnswerRe: dynamic array sizes Pin
David Crow20-Nov-06 3:25
David Crow20-Nov-06 3:25 
QuestionPostMessageand SendMessage Pin
neha.agarwal2718-Nov-06 1:46
neha.agarwal2718-Nov-06 1:46 
AnswerRe: PostMessageand SendMessage Pin
Arman S.18-Nov-06 6:59
Arman S.18-Nov-06 6:59 
Questionhow to register ATL COM object in MFC Pin
kiranin17-Nov-06 23:56
kiranin17-Nov-06 23:56 
AnswerRe: how to register ATL COM object in MFC Pin
ThatsAlok18-Nov-06 0:47
ThatsAlok18-Nov-06 0:47 
GeneralRe: how to register ATL COM object in MFC Pin
kiranin18-Nov-06 0:53
kiranin18-Nov-06 0:53 
QuestionAdd context menu item through MFC Application Pin
kiranin17-Nov-06 23:59
kiranin17-Nov-06 23:59 
AnswerRe: Add context menu item through MFC Application Pin
ThatsAlok18-Nov-06 0:47
ThatsAlok18-Nov-06 0:47 
GeneralRe: Add context menu item through MFC Application Pin
kiranin18-Nov-06 0:59
kiranin18-Nov-06 0:59 
GeneralRe: Add context menu item through MFC Application Pin
Hamid_RT18-Nov-06 1:08
Hamid_RT18-Nov-06 1:08 
GeneralRe: Add context menu item through MFC Application Pin
ThatsAlok18-Nov-06 1:28
ThatsAlok18-Nov-06 1:28 
QuestionSHGetFolderLocation() function gives compile time error. Pin
Sameer_Thakur17-Nov-06 21:40
Sameer_Thakur17-Nov-06 21:40 
AnswerRe: SHGetFolderLocation() function gives compile time error. Pin
Hamid_RT17-Nov-06 23:47
Hamid_RT17-Nov-06 23:47 
GeneralRe: SHGetFolderLocation() function gives compile time error. Pin
Sameer_Thakur18-Nov-06 0:40
Sameer_Thakur18-Nov-06 0:40 
GeneralRe: SHGetFolderLocation() function gives compile time error. Pin
Hamid_RT18-Nov-06 1:05
Hamid_RT18-Nov-06 1:05 
GeneralRe: SHGetFolderLocation() function gives compile time error. Pin
Sameer_Thakur18-Nov-06 5:02
Sameer_Thakur18-Nov-06 5:02 
GeneralRe: SHGetFolderLocation() function gives compile time error. Pin
Hamid_RT18-Nov-06 5:23
Hamid_RT18-Nov-06 5:23 

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.