Click here to Skip to main content
15,891,976 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Conversion from Cstring to LPSTR Pin
ThatsAlok18-Jul-09 7:45
ThatsAlok18-Jul-09 7:45 
AnswerRe: Conversion from Cstring to LPSTR Pin
Nemanja Trifunovic17-Jul-09 3:42
Nemanja Trifunovic17-Jul-09 3:42 
QuestionHow to disable CDockablePane context menu? Pin
eight17-Jul-09 1:37
eight17-Jul-09 1:37 
AnswerRe: How to disable CDockablePane context menu? Pin
Randor 17-Jul-09 2:26
professional Randor 17-Jul-09 2:26 
GeneralRe: How to disable CDockablePane context menu? Pin
eight19-Jul-09 17:02
eight19-Jul-09 17:02 
GeneralRe: How to disable CDockablePane context menu? Pin
eight19-Jul-09 17:54
eight19-Jul-09 17:54 
AnswerRe: How to disable CDockablePane context menu? Pin
severin09-Oct-09 8:17
severin09-Oct-09 8:17 
QuestionPragma pack, pointer, 32 vs 64 bits build Pin
Kochise17-Jul-09 0:55
Kochise17-Jul-09 0:55 
Hello folks, I'm encountering a problem. Doing message-passing, I'm sending/receiving buffers from various/mixed architectured machines (32 and 64 bits). I first tried to use this as a buffer skeleton :
typedef struct{ // size, offset 32 bits, offset 64 bits
  int   nCount;    //  4,  0,  0
  short nMode;     //  2,  4,  4 <- ???
  sHue  sColor;    //  8,  8,  8
  char* pTest;     //  4, 16, 16
  char  aData[10]; // 10, 20, 24
}sStack,*psStack;  // 28 (real) -> 32 (sizeof 32 bits), 40 (sizeof 64 bits)

On a 32 bits platform, if aData is grown to 12, it fits the whole struct size (12 bytes from offset 20 = 32), thus growing it to 13 push the struct's end to 36 (4 bytes alignment).
However I *NEED* the struct to be exactly the same size, whenever this code runs on a 32 bits machine or, you might have guessed it, a 64 bits one. So I tried :
#pragma pack(8)
  typedef struct{
[...].  }sStack,*psStack;
#pragma pack()

Yet it just doesn't works like expected on a 32 bits build. The struct's size is still 32 bytes, whereas I expected at least 36 (pTest pointer using 8 bytes, thus aData lying at offset 24, hence growing the struct to 34 bytes, aligned to 36 bytes).

stdcall or cdecl calls should remains set to 32 or 64 bits accordingly to the native platform, that means a ((psStack)buff)->pTest instruction shouldn't need to be casted for suiting 32 or 64 bits build. I just need the pointers in struct to be casted to the size of an __int64 (with the needed 4 padding bytes) !

Any luck someone to have a hint, a trick, or just the full answer ? Thanks anyway...

Kochise

In Code we trust !

AnswerRe: Pragma pack, pointer, 32 vs 64 bits build [modified] Pin
Kochise17-Jul-09 1:17
Kochise17-Jul-09 1:17 
GeneralRe: Pragma pack, pointer, 32 vs 64 bits build Pin
Randor 17-Jul-09 1:54
professional Randor 17-Jul-09 1:54 
AnswerRe: Pragma pack, pointer, 32 vs 64 bits build Pin
Stuart Dootson17-Jul-09 1:50
professionalStuart Dootson17-Jul-09 1:50 
GeneralRe: Pragma pack, pointer, 32 vs 64 bits build [modified] Pin
Kochise17-Jul-09 5:44
Kochise17-Jul-09 5:44 
GeneralRe: Pragma pack, pointer, 32 vs 64 bits build Pin
Stuart Dootson17-Jul-09 13:05
professionalStuart Dootson17-Jul-09 13:05 
AnswerRe: Pragma pack, pointer, 32 vs 64 bits build Pin
cmk17-Jul-09 8:54
cmk17-Jul-09 8:54 
GeneralRe: Pragma pack, pointer, 32 vs 64 bits build Pin
Kochise17-Jul-09 10:32
Kochise17-Jul-09 10:32 
GeneralRe: Pragma pack, pointer, 32 vs 64 bits build Pin
cmk17-Jul-09 11:43
cmk17-Jul-09 11:43 
QuestionBHO IE7 problem when protected mode is ON? Pin
svt gdwl17-Jul-09 0:16
svt gdwl17-Jul-09 0:16 
AnswerRe: BHO IE7 problem when protected mode is ON? Pin
Michael Schubert17-Jul-09 0:51
Michael Schubert17-Jul-09 0:51 
GeneralRe: BHO IE7 problem when protected mode is ON? Pin
ThatsAlok18-Jul-09 7:45
ThatsAlok18-Jul-09 7:45 
QuestionSpecifying unicode strings Pin
Jon17-Jul-09 0:14
Jon17-Jul-09 0:14 
AnswerRe: Specifying unicode strings Pin
Randor 17-Jul-09 0:32
professional Randor 17-Jul-09 0:32 
GeneralRe: Specifying unicode strings Pin
Jon17-Jul-09 0:56
Jon17-Jul-09 0:56 
GeneralRe: Specifying unicode strings Pin
Michael Schubert17-Jul-09 1:10
Michael Schubert17-Jul-09 1:10 
GeneralRe: Specifying unicode strings Pin
Jon17-Jul-09 2:49
Jon17-Jul-09 2:49 
GeneralRe: Specifying unicode strings Pin
Michael Schubert17-Jul-09 3:12
Michael Schubert17-Jul-09 3:12 

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.