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

C / C++ / MFC

 
GeneralRe: Packing sections down to byte alignment? Pin
Maxwell Chen7-Jan-08 7:08
Maxwell Chen7-Jan-08 7:08 
GeneralRe: Packing sections down to byte alignment? Pin
bgrupczy7-Jan-08 8:31
professionalbgrupczy7-Jan-08 8:31 
GeneralRe: Packing sections down to byte alignment? Pin
Maxwell Chen7-Jan-08 15:06
Maxwell Chen7-Jan-08 15:06 
GeneralRe: Packing sections down to byte alignment? Pin
bgrupczy8-Jan-08 4:44
professionalbgrupczy8-Jan-08 4:44 
GeneralRe: Packing sections down to byte alignment? Pin
Maxwell Chen8-Jan-08 5:31
Maxwell Chen8-Jan-08 5:31 
GeneralRe: Packing sections down to byte alignment? Pin
bgrupczy7-Jan-08 6:32
professionalbgrupczy7-Jan-08 6:32 
GeneralRe: Packing sections down to byte alignment? Pin
cmk7-Jan-08 17:50
cmk7-Jan-08 17:50 
GeneralRe: Packing sections down to byte alignment? Pin
Maxwell Chen7-Jan-08 19:24
Maxwell Chen7-Jan-08 19:24 
How about the below sample?!
Compile in Release Mode with VC++ 2005.
Additional option=
 /SECTION:MY,RW,ALIGN=2

#pragma pack(1)
struct B69
{
  int a;
  int b;
  short c;
  char d[59];
};
struct B37
{
  char a[37];
};
#pragma pack()
#pragma bss_seg(push, "MY$AA")
B69  b69;
#pragma bss_seg(pop)
#pragma bss_seg(push, "MY$AB")
B37  b37;
#pragma bss_seg(pop)
void main()
{
  printf("sizeof(B69) = %d \n", sizeof(B69));
  printf("b69 = %p, \n"
         "b69.a = %p, b69.b = &p, b69.c = %p, b69.d[0] = %p \n"
         "b69.d[58] = %p, b37 = %p \n",
         &b69,
         &b69.a, &b69.b, &b69.c, &b69.d[0],
         &b69.d[58], &b37 );
}

Result:
sizeof(B69) = 69
b69 = 00402000,
b69.a = 00402000, b69.b = 00402004, b69.c = 00402008, b69.d[0] = 0040200A,
b69.d[58] = 00402044, b37 = 00402048



Maxwell Chen

GeneralRe: Packing sections down to byte alignment? Pin
cmk8-Jan-08 3:26
cmk8-Jan-08 3:26 
GeneralRe: Packing sections down to byte alignment? Pin
bgrupczy8-Jan-08 4:58
professionalbgrupczy8-Jan-08 4:58 
GeneralRe: Packing sections down to byte alignment? Pin
bgrupczy8-Jan-08 7:30
professionalbgrupczy8-Jan-08 7:30 
GeneralRe: Packing sections down to byte alignment? Pin
cmk8-Jan-08 10:55
cmk8-Jan-08 10:55 
GeneralRe: Packing sections down to byte alignment? Pin
bgrupczy8-Jan-08 11:10
professionalbgrupczy8-Jan-08 11:10 
GeneralRe: Packing sections down to byte alignment? Pin
cmk8-Jan-08 11:17
cmk8-Jan-08 11:17 
GeneralRe: Packing sections down to byte alignment? Pin
bgrupczy9-Jan-08 6:19
professionalbgrupczy9-Jan-08 6:19 
GeneralConvert JIS to ASCII... Pin
Chris Losinger6-Jan-08 5:53
professionalChris Losinger6-Jan-08 5:53 
GeneralRe: Convert JIS to ASCII... Pin
Nemanja Trifunovic6-Jan-08 6:07
Nemanja Trifunovic6-Jan-08 6:07 
GeneralRe: Convert JIS to ASCII... Pin
Chris Losinger6-Jan-08 6:16
professionalChris Losinger6-Jan-08 6:16 
GeneralRe: Convert JIS to ASCII... Pin
Nemanja Trifunovic6-Jan-08 6:28
Nemanja Trifunovic6-Jan-08 6:28 
GeneralRe: Convert JIS to ASCII... Pin
Chris Losinger6-Jan-08 6:41
professionalChris Losinger6-Jan-08 6:41 
GeneralRe: Convert JIS to ASCII... Pin
Michael Dunn6-Jan-08 7:22
sitebuilderMichael Dunn6-Jan-08 7:22 
GeneralRe: Convert JIS to ASCII... Pin
Luc Pattyn6-Jan-08 7:37
sitebuilderLuc Pattyn6-Jan-08 7:37 
GeneralStrings from a c++ Dll to VB 6.0 and vice versa ! Pin
CrocodileBuck6-Jan-08 1:59
CrocodileBuck6-Jan-08 1:59 
QuestionRe: Strings from a c++ Dll to VB 6.0 and vice versa ! Pin
CPallini6-Jan-08 2:59
mveCPallini6-Jan-08 2:59 
GeneralRe: Strings from a c++ Dll to VB 6.0 and vice versa ! Pin
CrocodileBuck6-Jan-08 3:06
CrocodileBuck6-Jan-08 3:06 

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.