Click here to Skip to main content
15,890,670 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: tooltip localization problem Pin
Member 59031024-Mar-10 0:18
Member 59031024-Mar-10 0:18 
GeneralRe: tooltip localization problem Pin
Richard MacCutchan24-Mar-10 1:47
mveRichard MacCutchan24-Mar-10 1:47 
Questionmultibyte tooltips Pin
Member 59031023-Mar-10 20:22
Member 59031023-Mar-10 20:22 
AnswerRe: multibyte tooltips Pin
Richard MacCutchan23-Mar-10 22:35
mveRichard MacCutchan23-Mar-10 22:35 
QuestionStrange problem with pointers Pin
anbluemoon23-Mar-10 18:23
anbluemoon23-Mar-10 18:23 
AnswerRe: Strange problem with pointers Pin
PaulowniaK23-Mar-10 18:59
PaulowniaK23-Mar-10 18:59 
AnswerRe: Strange problem with pointers Pin
KingsGambit23-Mar-10 19:18
KingsGambit23-Mar-10 19:18 
AnswerRe: Strange problem with pointers Pin
Avi Berger23-Mar-10 20:01
Avi Berger23-Mar-10 20:01 
You haven't given us all the types and class/structure definitions involved.

You are also using a mess of casts and potential aliasing issues. You have to know what you are doing and be very careful to get this kind of stuff right.

anbluemoon wrote:
MD2Mesh::Frame* md2Frame = (MD2Mesh::Frame*)buffer;


Apparently, buffer is a SomeType_T *buffer set to the address of a block of allocated memory. What is SomeType_T? How big a block of memory? What is a MD2Mesh::Frame? How big is a MD2Mesh::Frame?

Also if MD2Mesh::Frame is not a pod type, you are dead without properly constructing it via its constructor.

anbluemoon wrote:
uint8* tmp = buffer + 40;
MD2Mesh::Vertex* vtx = (MD2Mesh::Vertex*)tmp;


Your magic number could be subject to breakage due to changes. Additionally, it hides your intent. Also don't forget about alignment issues and padding that the compiler can insert in structs.

md2Frame now points to the beginning of the buffer.
vtx now points inside the buffer.

anbluemoon wrote:
md2Frame->vertices = vtx;


You have now changed part of the contents of the buffer.

vtx has not changed at all. It is however a pointer, and what it points to in the buffer has changed because you wrote code to change it.

Evidently, MD2Mesh::Frame.vertices is 40 * sizeof(SomeType_T) bytes from the beginning of the structure.
Please do not read this signature.

GeneralRe: Strange problem with pointers Pin
anbluemoon23-Mar-10 22:47
anbluemoon23-Mar-10 22:47 
AnswerRe: Strange problem with pointers Pin
Mohan Ramachandra24-Mar-10 21:00
Mohan Ramachandra24-Mar-10 21:00 
QuestionWindows XP Problems since updating from VS2005 to VS2008 Pin
Joschwenk66623-Mar-10 11:12
Joschwenk66623-Mar-10 11:12 
AnswerRe: Windows XP Problems since updating from VS2005 to VS2008 Pin
Iain Clarke, Warrior Programmer23-Mar-10 12:06
Iain Clarke, Warrior Programmer23-Mar-10 12:06 
GeneralRe: Windows XP Problems since updating from VS2005 to VS2008 Pin
Joschwenk66624-Mar-10 8:22
Joschwenk66624-Mar-10 8:22 
GeneralRe: Windows XP Problems since updating from VS2005 to VS2008 Pin
Iain Clarke, Warrior Programmer24-Mar-10 9:32
Iain Clarke, Warrior Programmer24-Mar-10 9:32 
QuestionGetFileToSave and Windows 7 Pin
Psychopasta23-Mar-10 10:18
Psychopasta23-Mar-10 10:18 
QuestionRe: GetFileToSave and Windows 7 Pin
David Crow24-Mar-10 2:53
David Crow24-Mar-10 2:53 
AnswerRe: GetFileToSave and Windows 7 Pin
Psychopasta24-Mar-10 5:42
Psychopasta24-Mar-10 5:42 
QuestionRichEdit wrong list numbering with letters Pin
wp7323-Mar-10 8:55
wp7323-Mar-10 8:55 
AnswerRe: RichEdit wrong list numbering with letters Pin
wp7324-Mar-10 3:15
wp7324-Mar-10 3:15 
Questionproblem displaying unicode filenames in a list box Pin
sashoalm23-Mar-10 7:25
sashoalm23-Mar-10 7:25 
AnswerRe: problem displaying unicode filenames in a list box Pin
Eugen Podsypalnikov23-Mar-10 22:19
Eugen Podsypalnikov23-Mar-10 22:19 
QuestionSimple Treeview in MFC 2008 Pin
D.Manivelan23-Mar-10 3:54
D.Manivelan23-Mar-10 3:54 
AnswerRe: Simple Treeview in MFC 2008 Pin
Maximilien23-Mar-10 4:12
Maximilien23-Mar-10 4:12 
AnswerRe: Simple Treeview in MFC 2008 Pin
Iain Clarke, Warrior Programmer23-Mar-10 8:33
Iain Clarke, Warrior Programmer23-Mar-10 8:33 
QuestionStaticly linking MFC in VS2008 app produces compiling errors Pin
josip cagalj22-Mar-10 23:03
josip cagalj22-Mar-10 23:03 

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.