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

C / C++ / MFC

 
GeneralRe: Corruption of the Heap Error Pin
Foothill14-Feb-11 14:26
professionalFoothill14-Feb-11 14:26 
GeneralRe: Corruption of the Heap Error Pin
David Crow14-Feb-11 17:11
David Crow14-Feb-11 17:11 
GeneralRe: Corruption of the Heap Error Pin
ShilpiP14-Feb-11 19:13
ShilpiP14-Feb-11 19:13 
AnswerRe: Corruption of the Heap Error Pin
ShilpiP14-Feb-11 19:11
ShilpiP14-Feb-11 19:11 
AnswerRe: Corruption of the Heap Error Pin
Niklas L14-Feb-11 21:17
Niklas L14-Feb-11 21:17 
AnswerRe: Corruption of the Heap Error Pin
Stefan_Lang15-Feb-11 6:52
Stefan_Lang15-Feb-11 6:52 
GeneralRe: Corruption of the Heap Error Pin
Niklas L15-Feb-11 10:54
Niklas L15-Feb-11 10:54 
GeneralRe: Corruption of the Heap Error Pin
Stefan_Lang15-Feb-11 22:10
Stefan_Lang15-Feb-11 22:10 
I understand your words, but I fail to see under which circumstances such a construct would be needed, and in what way my suggestion wouldn't work. The only difference would be the need for an additional 4 (or 8) bytes for the pointer variable. In return, you'll get a struct that actually does what the definition implies rather than one that will inexplicably fail on standard assignments.

[edit]
P.S.: just thought of an example that would indeed benefit from such a construct: memory allocation functions. You'd allocate a consecutive chunk of memory big enough to not only hold the array of data as requested, but also additional info (such as block size or debug info), then return the starting address of the array. Upon deletion, thanks to the consecutive block, you can manipulate the pointer to the array to access that additional information again.

In this case, the consecutive allocation serves as a means to store hidden information and later access it with no additional info required beyond the address of the user data.

Not something you couldn't also do with C++ constructs such as delegates, but that is what to my knowledge the debug implementation of new and delete do.
[/edit]
GeneralRe: Corruption of the Heap Error [modified] Pin
Niklas L15-Feb-11 22:37
Niklas L15-Feb-11 22:37 
GeneralRe: Corruption of the Heap Error Pin
Stefan_Lang15-Feb-11 22:51
Stefan_Lang15-Feb-11 22:51 
GeneralRe: Corruption of the Heap Error [modified] Pin
Niklas L15-Feb-11 23:13
Niklas L15-Feb-11 23:13 
GeneralRe: Corruption of the Heap Error Pin
Niklas L16-Feb-11 6:57
Niklas L16-Feb-11 6:57 
GeneralRe: Corruption of the Heap Error Pin
Stefan_Lang16-Feb-11 22:22
Stefan_Lang16-Feb-11 22:22 
GeneralRe: Corruption of the Heap Error Pin
Niklas L16-Feb-11 23:12
Niklas L16-Feb-11 23:12 
GeneralRe: Corruption of the Heap Error Pin
Stefan_Lang17-Feb-11 1:10
Stefan_Lang17-Feb-11 1:10 
GeneralRe: Corruption of the Heap Error Pin
Niklas L17-Feb-11 1:34
Niklas L17-Feb-11 1:34 
GeneralRe: Corruption of the Heap Error Pin
Stefan_Lang17-Feb-11 1:42
Stefan_Lang17-Feb-11 1:42 
GeneralRe: Corruption of the Heap Error Pin
Foothill15-Feb-11 11:16
professionalFoothill15-Feb-11 11:16 
QuestionHow to use CMFCVisualManagerOffice2007 in dialog App? Pin
stephen_young14-Feb-11 3:24
stephen_young14-Feb-11 3:24 
AnswerRe: How to use CMFCVisualManagerOffice2007 in dialog App? Pin
David Crow14-Feb-11 3:43
David Crow14-Feb-11 3:43 
GeneralRe: How to use CMFCVisualManagerOffice2007 in dialog App? Pin
stephen_young14-Feb-11 6:14
stephen_young14-Feb-11 6:14 
QuestionMulti Language Support Pin
T.RATHA KRISHNAN14-Feb-11 2:44
T.RATHA KRISHNAN14-Feb-11 2:44 
AnswerRe: Multi Language Support Pin
loyal ginger14-Feb-11 10:16
loyal ginger14-Feb-11 10:16 
AnswerRe: Multi Language Support Pin
yu-jian14-Feb-11 16:29
yu-jian14-Feb-11 16:29 
AnswerRe: Multi Language Support Pin
ShilpiP14-Feb-11 18:17
ShilpiP14-Feb-11 18:17 

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.