Click here to Skip to main content
15,921,660 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: what is the role of #pragma pack(1) Pin
Cedric Moonen26-Mar-07 2:50
Cedric Moonen26-Mar-07 2:50 
AnswerRe: what is the role of #pragma pack(1) Pin
Nibu babu thomas26-Mar-07 3:16
Nibu babu thomas26-Mar-07 3:16 
GeneralRe: what is the role of #pragma pack(1) Pin
Emil - Gabriel26-Mar-07 3:30
Emil - Gabriel26-Mar-07 3:30 
GeneralRe: what is the role of #pragma pack(1) Pin
Nibu babu thomas26-Mar-07 3:32
Nibu babu thomas26-Mar-07 3:32 
GeneralRe: what is the role of #pragma pack(1) Pin
David Crow26-Mar-07 3:59
David Crow26-Mar-07 3:59 
GeneralRe: what is the role of #pragma pack(1) Pin
Emil - Gabriel26-Mar-07 4:04
Emil - Gabriel26-Mar-07 4:04 
GeneralRe: what is the role of #pragma pack(1) Pin
David Crow26-Mar-07 4:17
David Crow26-Mar-07 4:17 
GeneralRe: what is the role of #pragma pack(1) Pin
Emil - Gabriel26-Mar-07 4:29
Emil - Gabriel26-Mar-07 4:29 
Can anyone explain that? Shouldn't the second structure be allocated using the default 8-byte alignment?OMG | :OMG:
Here's another example which should copy 8 bytes into 5:
#pragma pack( push, 1 ) // Set alignment to 1
struct IntParts1
{
   char byPart1;
   int byPart2;
};
#pragma pack( pop ) // Restore previous settings

struct IntParts2
{
   char byPart1;
   int byPart2;
};

IntParts1 ip1 = {0};
IntParts2 ip2 = {0};
memcpy( &ip1, &ip2, sizeof( ip1 ) );
printf( "%d, %d\n", sizeof( IntParts1 ), sizeof( IntParts2 ) );

And don't tell me they're both 5 bytes in size because i tested this time!Smile | :)
GeneralRe: what is the role of #pragma pack(1) Pin
David Crow26-Mar-07 4:39
David Crow26-Mar-07 4:39 
GeneralRe: what is the role of #pragma pack(1) Pin
Mark Salsbery26-Mar-07 9:53
Mark Salsbery26-Mar-07 9:53 
GeneralRe: what is the role of #pragma pack(1) Pin
Emil - Gabriel26-Mar-07 20:12
Emil - Gabriel26-Mar-07 20:12 
GeneralRe: what is the role of #pragma pack(1) Pin
Mark Salsbery27-Mar-07 6:25
Mark Salsbery27-Mar-07 6:25 
GeneralRe: what is the role of #pragma pack(1) Pin
Mark Salsbery27-Mar-07 6:42
Mark Salsbery27-Mar-07 6:42 
QuestionSetting minimum size for a CFrameWnd Pin
maxmaven26-Mar-07 2:15
maxmaven26-Mar-07 2:15 
AnswerRe: Setting minimum size for a CFrameWnd Pin
prasad_som26-Mar-07 2:29
prasad_som26-Mar-07 2:29 
GeneralRe: Setting minimum size for a CFrameWnd Pin
maxmaven26-Mar-07 3:03
maxmaven26-Mar-07 3:03 
QuestionRe: Setting minimum size for a CFrameWnd Pin
prasad_som26-Mar-07 3:07
prasad_som26-Mar-07 3:07 
AnswerRe: Setting minimum size for a CFrameWnd Pin
maxmaven26-Mar-07 4:54
maxmaven26-Mar-07 4:54 
GeneralRe: Setting minimum size for a CFrameWnd Pin
David Crow26-Mar-07 4:58
David Crow26-Mar-07 4:58 
QuestionRe: Setting minimum size for a CFrameWnd Pin
David Crow26-Mar-07 2:48
David Crow26-Mar-07 2:48 
AnswerRe: Setting minimum size for a CFrameWnd Pin
maxmaven26-Mar-07 3:05
maxmaven26-Mar-07 3:05 
GeneralRe: Setting minimum size for a CFrameWnd Pin
David Crow26-Mar-07 3:10
David Crow26-Mar-07 3:10 
GeneralRe: Setting minimum size for a CFrameWnd Pin
maxmaven26-Mar-07 5:05
maxmaven26-Mar-07 5:05 
GeneralRe: Setting minimum size for a CFrameWnd Pin
David Crow26-Mar-07 5:27
David Crow26-Mar-07 5:27 
Questioncan anybody help me out with this error: Pin
ashokbngr26-Mar-07 1:56
ashokbngr26-Mar-07 1:56 

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.