Click here to Skip to main content
15,893,337 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
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 
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 
Kochise wrote:
I imagine it would be kind to pack the whole struct in a #pragma pack(1) fashion for message-passing, yet rendering it useless for run-time usage due to alignment fault that could arise


IIRC, x86 doesn't actually care about alignment - it's more for performance issues. Certainly this little program runs on x86 and x64, using non-word alignment:

int main()
{
   char x[] = {1,2,3,4,5,6,7,8};
   int* pp = (int*)(x+1);
   std::cout << std::hex << (*pp) << std::endl;
}




Alternatively - here's another thought - bit-fields:

typedef struct{ // size, offset 32 bits, offset 64 bits
    int  nCount  : 32;    //  4,  0,  0
    int  nMode   : 16;     //  2,  4,  4 <- ???
    int  sColor  : 8;    //  8,  8,  8
    int  pTest   : 32;     //  4, 16, 16
    int  aData0_3  : 32; // 10, 20, 24
    int  aData4_7  : 32; // 10, 20, 24
    int  aData8_9  : 16; // 10, 20, 24
    
  }sStack,*psStack;


The array's been reconfigured slightly, but you could work around that.



Another option - serialize the struct to a byte-stream when sending, deserialize on the way back.

sStack Deserialize(BYTE* pBuffer, size_t nBytes)
{
   _ASSERTE(nBytes >= 4 + 2 + 1 + 8 + 4 + 10);
   sStack s;
   s.nCount = *(int*)pBuffer;
// etc etc
   return s;
}


Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

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 
GeneralRe: Specifying unicode strings Pin
Jon17-Jul-09 3:30
Jon17-Jul-09 3:30 
AnswerRe: Specifying unicode strings Pin
Michael Schubert17-Jul-09 0:41
Michael Schubert17-Jul-09 0:41 
GeneralRe: Specifying unicode strings Pin
Jon17-Jul-09 1:11
Jon17-Jul-09 1:11 
AnswerRe: Specifying unicode strings Pin
Adam Roderick J17-Jul-09 0:56
Adam Roderick J17-Jul-09 0:56 
GeneralRe: Specifying unicode strings Pin
Jon17-Jul-09 1:10
Jon17-Jul-09 1:10 

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.