°´¼üÅÌÉÏ·½Ïò¼ü ¡û »ò ¡ú ¿É¿ìËÙÉÏÏ·ҳ£¬°´¼üÅÌÉ쵀 Enter ¼ü¿É»Øµ½±¾ÊéĿ¼ҳ£¬°´¼üÅÌÉÏ·½Ïò¼ü ¡ü ¿É»Øµ½±¾Ò³¶¥²¿£¡
¡ª¡ª¡ª¡ªÎ´ÔĶÁÍꣿ¼ÓÈëÊéÇ©ÒѱãÏ´μÌÐøÔĶÁ£¡
¡£
3¡£6¡£2£¬#pragma¡¡
code_seg
ÁíÒ»¸öʹÓõñȽ϶àµÄ¡¡
pragma²ÎÊýÊÇ¡¡
code_seg¡£¸ñʽÈ磺¡¡
#pragma¡¡
code_seg£¨£§¡¨section¡name¡¨£§£»¡¨section¡class¡¨£§£§£©
ËüÄܹ»ÉèÖóÌÐòÖк¯Êý´úÂë´æ·ÅµÄ´úÂë¶Î£¬µ±ÎÒÃÇ¿ª·¢Çý¶¯³ÌÐòµÄʱºò¾Í»áʹÓõ½Ëü¡£
3¡£6¡£3£¬#pragma¡¡
once¡¡
#pragma¡¡
once£¨±È½Ï³£Óã©
Ö»ÒªÔÚÍ·ÎļþµÄ×ʼ¼ÓÈëÕâÌõÖ¸Áî¾ÍÄܹ»±£Ö¤Í·Îļþ±»±àÒëÒ»´Î£¬ÕâÌõÖ¸Áîʵ¼ÊÉÏÔÚ¡¡
VisualC£«£«6¡£0ÖоÍÒѾÓÐÁË£¬µ«ÊÇ¿¼Âǵ½¼æÈÝÐÔ²¢Ã»ÓÐÌ«¶àµÄʹÓÃËü¡£
3¡£6¡£4£¬#pragma¡¡
hdrstop¡¡
#pragma¡¡
hdrstop±íʾԤ±àÒëÍ·Îļþµ½´ËΪֹ£¬ºóÃæµÄÍ·Îļþ²»½øÐÐÔ¤±àÒë¡£BCB¿ÉÒÔ
Ô¤±àÒëÍ·ÎļþÒÔ¼Ó¿ìÁ´½ÓµÄËٶȣ¬µ«Èç¹ûËùÓÐÍ·Îļþ¶¼½øÐÐÔ¤±àÒëÓÖ¿ÉÄÜռ̫¶à´ÅÅ̿ռ䣬
ËùÒÔʹÓÃÕâ¸öÑ¡ÏîÅųýһЩͷÎļþ¡£
ÓÐʱµ¥ÔªÖ®¼äÓÐÒÀÀµ¹Øϵ£¬±ÈÈçµ¥Ôª¡¡
AÒÀÀµµ¥Ôª¡¡
B£¬ËùÒÔµ¥Ôª¡¡
BÒªÏÈÓÚµ¥Ôª¡¡
A±àÒë¡£
Äã¿ÉÒÔÓÃ#pragma¡¡
startupÖ¸¶¨±àÒëÓÅÏȼ¶£¬Èç¹ûʹÓÃÁË#pragma¡¡
package£¨smart_init£©£¬BCB
¾Í»á¸ù¾ÝÓÅÏȼ¶µÄ´óСÏȺó±àÒë¡£
3¡£6¡£5£¬#pragma¡¡
resource¡¡
#pragma¡¡
resource¡¨*¡£dfm¡¨±íʾ°Ñ*¡£dfmÎļþÖеÄ×ÊÔ´¼ÓÈ빤³Ì¡£*¡£dfmÖаüÀ¨´°Ìå
Íâ¹ÛµÄ¶¨Òå¡£
3¡£6¡£6£¬#pragma¡¡
warning¡¡
#pragma¡¡
warning£¨¡¡
disable£º¡¡
4507¡¡
34£»once£º¡¡
4385£»error¡¡
£º¡¡
164¡¡
£©
µÈ¼ÛÓÚ£º¡¡
#pragma¡¡
warning£¨disable£º4507¡¡
34£©//²»ÏÔʾ¡¡
4507ºÍ¡¡
34ºÅ¾¯¸æÐÅÏ¢¡¡
#pragma¡¡
warning£¨once£º4385£©¡¡
//¡¡
4385ºÅ¾¯¸æÐÅÏ¢½ö±¨¸æÒ»´Î¡¡
#pragma¡¡
warning£¨error£º164£©¡¡
//°Ñ¡¡
164ºÅ¾¯¸æÐÅÏ¢×÷Ϊһ¸ö´íÎó¡£
ͬʱÕâ¸ö¡¡
pragmawarningÒ²Ö§³ÖÈçϸñʽ£º¡¡
#pragma¡¡
warning£¨push£§£»n£§£©¡¡
#pragma¡¡
warning£¨pop£©
ÕâÀï¡¡
n´ú±íÒ»¸ö¾¯¸æµÈ¼¶£¨1¡4£©¡£¡¡
#pragma¡¡
warning£¨push£©±£´æËùÓо¯¸æÐÅÏ¢µÄÏÖÓеľ¯¸æ״̬¡£¡¡
#pragma¡¡
warning£¨push£»n£©±£´æËùÓо¯¸æÐÅÏ¢µÄÏÖÓеľ¯¸æ״̬£¬²¢ÇÒ°ÑÈ«¾Ö¾¯¸æ
µÈ¼¶É趨Ϊ¡¡
n¡£¡¡
#pragma¡¡
warning£¨pop£©ÏòÕ»Öе¯³ö×îºóÒ»¸ö¾¯¸æÐÅÏ¢£¬ÔÚÈëÕ»ºÍ³öÕ»Ö®¼äËù×÷µÄ
Ò»ÇиĶ¯È¡Ïû¡£ÀýÈ磺¡¡
#pragma¡¡
warning£¨push£©¡¡
#pragma¡¡
warning£¨¡¡
disable£º¡¡
4705¡¡
£©¡¡
#pragma¡¡
warning£¨¡¡
disable£º¡¡
4706¡¡
£©¡¡
#pragma¡¡
warning£¨¡¡
disable£º¡¡
4707¡¡
£©¡¡
//¡£¡£¡£¡£¡£¡£¡£¡¡
#pragma¡¡
warning£¨¡¡
pop£©
ÔÚÕâ¶Î´úÂëµÄ×îºó£¬ÖØб£´æËùÓеľ¯¸æÐÅÏ¢£¨°üÀ¨¡¡
4705£¬4706ºÍ¡¡
4707£©¡£
3¡£6¡£7£¬#pragma¡¡
ment¡¡
#pragma¡¡
ment£¨¡£¡£¡££©
¸ÃÖ¸Áһ¸ö×¢ÊͼǼ·ÅÈëÒ»¸ö¶ÔÏóÎļþ»ò¿ÉÖ´ÐÐÎļþÖС£
³£Óõġ¡
lib¹Ø¼ü×Ö£¬¿ÉÒÔ°ïÎÒÃÇÁ¬ÈëÒ»¸ö¿âÎļþ¡£±ÈÈ磺¡¡
#pragma¡¡
ment£¨lib£»¡¨user32¡£lib¡¨£©
¸ÃÖ¸ÁîÓÃÀ´½«¡¡
user32¡£lib¿âÎļþ¼ÓÈëµ½±¾¹¤³ÌÖС£¡¡
linker£º½«Ò»¸öÁ´½ÓÑ¡Ïî·ÅÈëÄ¿±êÎļþÖУ»Äã¿ÉÒÔʹÓÃÕâ¸öÖ¸ÁîÀ´´úÌæÓÉÃüÁîÐд«ÈëµÄ»ò
ÕßÔÚ¿ª·¢»·¾³ÖÐÉèÖõÄÁ´½ÓÑ¡ÏÄã¿ÉÒÔÖ¸¶¨/includeÑ¡ÏîÀ´Ç¿ÖÆ°üº¬Ä³¸ö¶ÔÏó£»ÀýÈ磺¡¡
#pragma¡¡
ment£¨linker£»¡¨/include£º__mySymbol¡¨£©
3¡£6¡£8£¬#pragma¡¡
pack
ÕâÀïÖصãÌÖÂÛÄÚ´æ¶ÔÆëµÄÎÊÌâºÍ#pragmapack£¨£©µÄʹÓ÷½·¨¡£
ʲôÊÇÄÚ´æ¶ÔÆ룿
ÏÈ¿´ÏÂÃæµÄ½á¹¹£º¡¡
structTestStruct1¡¡
£û¡¡
char¡¡
c1£»¡¡
shorts£»¡¡
char¡¡
c2£»¡¡
inti£»¡¡
£ý£»
¼ÙÉèÕâ¸ö½á¹¹µÄ³ÉÔ±ÔÚÄÚ´æÖÐÊǽô´ÕÅÅÁеģ¬¼ÙÉè¡¡
c1µÄµØÖ·ÊÇ¡¡
0£¬ÄÇô¡¡
sµÄµØÖ·¾ÍÓ¦¸Ã
ÊÇ¡¡
1£¬c2µÄµØÖ·¾ÍÊÇ¡¡
3£¬iµÄµØÖ·¾ÍÊÇ¡¡
4¡£Ò²¾ÍÊÇ¡¡
c1µØַΪ¡¡
00000000£»sµØַΪ¡¡
00000001£»c2
µØַΪ¡¡
00000003£»iµØַΪ¡¡
00000004¡£
¿ÉÊÇ£¬ÎÒÃÇÔÚ¡¡
VisualC£«£«6¡£0ÖÐдһ¸ö¼òµ¥µÄ³ÌÐò£º¡¡
structTestStruct1a£»¡¡
printf£¨¡¨c1£¥p£»s£¥p£»c2£¥p£»i¡¡
£¥pn¡¨£»¡¡
£¨unsignedint£©£¨void*£©&a¡£c1¡£¨unsigned¡¡
int£©£¨void*£©&a£»¡¡
£¨unsignedint£©£¨void*£©&a¡£s¡¡
¡£¨unsignedint£©£¨void*£©&a£»¡¡
£¨unsignedint£©£¨void*£©&a¡£c2¡£¨unsigned¡¡
int£©£¨void*£©&a£»¡¡
£¨unsignedint£©£¨void*£©&a¡£i¡¡
¡£¨unsignedint£©£¨void*£©&a£©£»
ÔËÐУ¬Êä³ö£º¡¡
c100000000£»s00000002£»c200000004£»i00000008¡£
Ϊʲô»áÕâÑù£¿Õâ¾ÍÊÇÄÚ´æ¶ÔÆë¶øµ¼ÖµÄÎÊÌâ¡£
3¡£6¡£8¡£1£¬ÎªÊ²Ã´»áÓÐÄÚ´æ¶ÔÆ룿
×Ö£¬Ë«×Ö£¬ºÍËÄ×ÖÔÚ×ÔÈ»±ß½çÉϲ»ÐèÒªÔÚÄÚ´æÖжÔÆë¡££¨¶Ô×Ö£¬Ë«×Ö£¬ºÍËÄ×ÖÀ´Ëµ£¬×Ô
È»±ß½ç·Ö±ðÊÇżÊýµØÖ·£¬¿ÉÒÔ±»¡¡
4Õû³ýµÄµØÖ·£¬ºÍ¿ÉÒÔ±»¡¡
8Õû³ýµÄµØÖ·¡££©ÎÞÂÛÈçºÎ£¬ÎªÁË
Ìá¸ß³ÌÐòµÄÐÔÄÜ£¬Êý¾Ý½á¹¹£¨ÓÈÆäÊÇÕ»£©Ó¦¸Ã¾¡¿ÉÄܵØÔÚ×ÔÈ»±ß½çÉ϶ÔÆë¡£ÔÒòÔÚÓÚ£¬Îª
ÁË·ÃÎÊδ¶ÔÆëµÄÄڴ棬´¦ÀíÆ÷ÐèÒª×÷Á½´ÎÄÚ´æ·ÃÎÊ£»È»¶ø£¬¶ÔÆëµÄÄÚ´æ·ÃÎʽöÐèÒªÒ»´Î·Ã
ÎÊ¡£
Ò»¸ö×Ö»òË«×Ö²Ù×÷Êý¿çÔ½ÁË¡¡
4×ֽڱ߽磬»òÕßÒ»¸öËÄ×Ö²Ù×÷Êý¿çÔ½ÁË¡¡
8×ֽڱ߽磬±»
ÈÏΪÊÇδ¶ÔÆëµÄ£¬´Ó¶øÐèÒªÁ½´Î×ÜÏßÖÜÆÚÀ´·ÃÎÊÄÚ´æ¡£Ò»¸ö×ÖÆðʼµØÖ·ÊÇÆæÊýµ«È´Ã»Óпç
Ô½×ֱ߽类ÈÏΪÊǶÔÆëµÄ£¬Äܹ»ÔÚÒ»¸ö×ÜÏßÖÜÆÚÖб»·ÃÎÊ¡£Ä³Ð©²Ù×÷Ë«ËÄ×ÖµÄÖ¸ÁîÐèÒªÄÚ
´æ²Ù×÷ÊýÔÚ×ÔÈ»±ß½çÉ϶ÔÆë¡£Èç¹û²Ù×÷ÊýûÓжÔÆ룬ÕâЩָÁ»á²úÉúÒ»¸öͨÓñ£»¤Òì³£¡£
Ë«ËÄ×ÖµÄ×ÔÈ»±ß½çÊÇÄܹ»±»¡¡
16Õû³ýµÄµØÖ·¡£ÆäËûµÄ²Ù×÷Ë«ËÄ×ÖµÄÖ¸ÁîÔÊÐíδ¶ÔÆëµÄ·ÃÎÊ
£¨²»»á²úÉúͨÓñ£»¤Òì³££©£¬È»¶ø£¬ÐèÒª¶îÍâµÄÄÚ´æ×ÜÏßÖÜÆÚÀ´·ÃÎÊÄÚ´æÖÐδ¶ÔÆëµÄÊý¾Ý¡£
ȱʡÇé¿öÏ£¬±àÒëÆ÷ĬÈϽ«½á¹¹¡¢Õ»ÖеijÉÔ±Êý¾Ý½øÐÐÄÚ´æ¶ÔÆë¡£Òò´Ë£¬ÉÏÃæµÄ³ÌÐòÊä
³ö¾Í±ä³ÉÁË£ºc100000000£»s00000002£»c200000004£»i¡¡
00000008¡£±àÒëÆ÷½«Î´¶ÔÆëµÄ³ÉÔ±Ïòºó
ÒÆ£¬½«Ã¿Ò»¸ö¶¼³ÉÔ±¶ÔÆëµ½×ÔÈ»±ß½çÉÏ£¬´Ó¶øÒ²µ¼ÖÂÁËÕû¸ö½á¹¹µÄ³ß´ç±ä´ó¡£¾¡¹Ü»áÎþÉü
Ò»µã¿Õ¼ä£¨³ÉÔ±Ö®¼äÓв¿·ÖÄÚ´æ¿ÕÏУ©£¬µ«Ìá¸ßÁËÐÔÄÜ¡£Ò²ÕýÊÇÕâ¸öÔÒò£¬ÎÒÃDz»¿ÉÒÔ¶ÏÑÔ¡¡
sizeof£¨TestStruct1£©µÄ½á¹ûΪ¡¡
8¡£ÔÚÕâ¸öÀý×ÓÖУ¬sizeof£¨TestStruct1£©µÄ½á¹ûΪ¡¡
12¡£
3¡£6¡£8¡£2£¬ÈçºÎ±ÜÃâÄÚ´æ¶ÔÆëµÄÓ°Ïì
ÄÇô£¬Äܲ»ÄܼȴﵽÌá¸ßÐÔÄܵÄÄ¿µÄ£¬ÓÖÄܽÚÔ¼Ò»µã¿Õ¼äÄØ£¿ÓÐÒ»µãС¼¼ÇÉ¿ÉÒÔʹÓá£
±ÈÈçÎÒÃÇ¿ÉÒÔ½«ÉÏÃæµÄ½á¹¹¸Ä³É£º¡¡
structTestStruct2¡¡
£û¡¡
char¡¡
c1£»¡¡
char¡¡
c2£»¡¡
shorts£»¡¡
inti£»¡¡
£ý£»
ÕâÑùÒ»À´£¬Ã¿¸ö³ÉÔ±¶¼¶ÔÆëÔÚÆä×ÔÈ»±ß½çÉÏ£¬´Ó¶ø±ÜÃâÁ˱àÒëÆ÷×Ô¶¯¶ÔÆë¡£ÔÚÕâ¸öÀý
×ÓÖУ¬sizeof£¨TestStruct2£©µÄֵΪ¡¡
8¡£Õâ¸ö¼¼ÇÉÓÐÒ»¸öÖØÒªµÄ×÷Óã¬ÓÈÆäÊÇÕâ¸ö½á¹¹×÷Ϊ¡¡
API
µÄÒ»²¿·ÖÌṩ¸øµÚÈý·½¿ª·¢Ê¹ÓõÄʱºò¡£µÚÈý·½¿ª·¢Õß¿ÉÄܽ«±àÒëÆ÷µÄĬÈ϶ÔÆëÑ¡Ïî¸Ä±ä£¬
´Ó¶øÔì³ÉÕâ¸ö½á¹¹ÔÚÄãµÄ·¢Ðеġ¡
DLLÖÐʹÓÃijÖÖ¶ÔÆ뷽ʽ£¬¶øÔÚµÚÈý·½¿ª·¢ÕßÄÄÀïȴʹÓÃ
ÁíÍâÒ»ÖÖ¶ÔÆ뷽ʽ¡£Õ⽫»áµ¼ÖÂÖØ´óÎÊÌâ¡£
±ÈÈ磬TestStruct1½á¹¹£¬ÎÒÃǵġ¡
DLLʹÓÃĬÈ϶ÔÆëÑ¡Ï¶ÔÆëΪ¡¡
c100000000£»s00000002£»c200000004£»i¡¡
00000008£¬Í¬Ê±¡¡
sizeof£¨TestStruct1£©µÄֵΪ¡¡
12¡£
¶øµÚÈý·½½«¶ÔÆëÑ¡Ïî¹Ø±Õ£¬µ¼Ö¡¡
c100000000£»s00000001£»c200000003£»i¡¡
00000004£¬Í¬Ê±¡¡
sizeof£¨TestStruct1£©µÄֵΪ¡¡
8¡£
³ý´ËÖ®ÍâÎÒÃÇ»¹¿ÉÒÔÀûÓÃ#pragma¡¡
pack£¨£©À´¸Ä±ä±àÒëÆ÷µÄĬÈ϶ÔÆ뷽ʽ£¨µ±È»Ò»°ã±àÒëÆ÷
Ò²ÌṩÁËһЩ¸Ä±ä¶ÔÆ뷽ʽµÄÑ¡ÏÕâÀï²»ÌÖÂÛ£©¡£
ʹÓÃÖ¸Áî#pragma¡¡
pack¡¡
£¨n£©£¬±àÒëÆ÷½«°´ÕÕ¡¡
n¸ö×Ö½Ú¶ÔÆë¡£
ʹÓÃÖ¸Áî#pragma¡¡
pack¡¡
£¨£©£¬±àÒëÆ÷½«È¡Ïû×Ô¶¨Òå×Ö½Ú¶ÔÆ뷽ʽ¡£
ÔÚ#pragma¡¡
pack¡¡
£¨n£©ºÍ#pragma¡¡
pack¡¡
£¨£©Ö®¼äµÄ´úÂë°´¡¡
n¸ö×Ö½Ú¶ÔÆë¡£
µ«ÊÇ£¬³ÉÔ±¶ÔÆëÓÐÒ»¸öÖØÒªµÄÌõ¼þ¡¡
£»¼´Ã¿¸ö³ÉÔ±°´×Ô¼ºµÄ·½Ê½¶ÔÆë¡£Ò²¾ÍÊÇ˵ËäȻָ¶¨ÁË
°´¡¡
n×Ö½Ú¶ÔÆ룻µ«²¢²»ÊÇËùÓеijÉÔ±¶¼ÊÇÒÔ¡¡
n×Ö½Ú¶ÔÆë¡£Æä¶ÔÆëµÄ¹æÔòÊÇ¡¡
£»Ã¿¸ö³ÉÔ±°´ÆäÀàÐÍ
µÄ¶ÔÆë²ÎÊý£¨Í¨³£ÊÇÕâ¸öÀàÐ͵ĴóС£©ºÍÖ¸¶¨¶ÔÆë²ÎÊý£¨ÕâÀïÊÇ¡¡
n×Ö½Ú£©ÖнÏСµÄÒ»¸ö¶ÔÆ룬¼´£º¡¡
min£¨¡¡
n£»sizeof£¨¡¡
item¡¡
£©£©¡£²¢ÇҽṹµÄ³¤¶È±ØÐëΪËùÓùýµÄËùÓжÔÆë²ÎÊýµÄÕûÊý±¶£»²»¹»¾Í²¹¿Õ
×Ö½Ú¡£¿´ÈçÏÂÀý×Ó£º¡¡
#pragma¡¡
pack£¨8£©¡¡
structTestStruct4¡¡
£û¡¡
char¡¡
a£»¡¡
long¡¡
b£»¡¡
£ý£»¡¡
structTestStruct5¡¡
£û¡¡
char¡¡
c£»¡¡
TestStruct4¡¡
d£»¡¡
longlonge£»¡¡
£ý£»¡¡
#pragma¡¡
pack£¨£©
ÎÊÌ⣺¡¡
A£©£»sizeof£¨TestStruct5£©=£¿¡¡
B£©£»TestStruct5µÄ¡¡
cºóÃæ¿ÕÁ˼¸¸ö×Ö½Ú½Ó×ÅÊÇ¡¡
d£¿¡¡
TestStruct4ÖУ»³ÉÔ±¡¡
aÊÇ¡¡
1×Ö½ÚĬÈÏ°´¡¡
1×Ö½Ú¶ÔÆ룻ָ¶¨¶ÔÆë²ÎÊýΪ¡¡
8£»ÕâÁ½¸öÖµÖÐÈ¡¡¡
1£»a
°´¡¡
1×Ö½Ú¶ÔÆ룻³ÉÔ±¡¡
bÊÇ¡¡
4¸ö×Ö½Ú£»Ä¬ÈÏÊÇ°´¡¡
4×Ö½Ú¶ÔÆ룻Õâʱ¾Í°´¡¡
4×Ö½Ú¶ÔÆ룻ËùÒÔ¡¡
sizeof£¨TestStruct4£©Ó¦¸ÃΪ¡¡
8£»¡¡
TestStruct5ÖУ»cºÍ¡¡
TestStruct4Öеġ¡
aÒ»Ñù£»°´¡¡
1×Ö½Ú¶ÔÆ룻¶ø¡¡
dÊǸö½á¹¹£»ËüÊÇ¡¡
8¸ö×Ö½Ú£»Ëü
°´Ê²Ã´¶ÔÆëÄØ£¿¶ÔÓڽṹÀ´Ëµ£»ËüµÄĬÈ϶ÔÆ뷽ʽ¾ÍÊÇËüµÄËùÓгÉԱʹÓõĶÔÆë²ÎÊýÖÐ×î´ó
µÄÒ»¸ö£»TestStruct4µÄ¾ÍÊÇ¡¡
4¡£ËùÒÔ£»³ÉÔ±¡¡
d¾ÍÊÇ°´¡¡
4×Ö½Ú¶ÔÆë¡£³ÉÔ±¡¡
eÊÇ¡¡
8¸ö×Ö½Ú£»ËüÊÇĬÈÏ°´¡¡
8
×Ö½Ú¶ÔÆ룻ºÍÖ¸¶¨µÄÒ»Ñù£»ËùÒÔËü¶Ôµ½¡¡
8×ֽڵı߽çÉÏ£»Õâʱ£»ÒѾʹÓÃÁË¡¡
12¸ö×Ö½ÚÁË£»ËùÒÔÓÖÌí
¼ÓÁË¡¡
4¸ö×ֽڵĿգ»´ÓµÚ¡¡
16¸ö×Ö½Ú¿ªÊ¼·ÅÖóÉÔ±¡¡
e¡£Õâʱ£»³¤¶ÈΪ¡¡
24£»ÒѾ¿ÉÒÔ±»¡¡
8£¨³ÉÔ±¡¡
e°´¡¡
8
×Ö½Ú¶ÔÆ룩Õû³ý¡£ÕâÑù£»Ò»¹²Ê¹ÓÃÁË¡¡
24¸ö×Ö½Ú¡£ÄÚ´æ²¼¾ÖÈçÏ£¨*±íʾ¿ÕÏÐÄڴ棬1±íʾʹÓÃÄÚ´æ¡£
µ¥Î»Îª¡¡
1byete£©£º¡¡
a¡¡
b¡¡
TestStruct4µÄÄÚ´æ²¼¾Ö£º1***£»1111£»¡¡
c¡¡
TestStruct4¡£a¡¡
TestStruct4¡£b¡¡
d¡¡
TestStruct5µÄÄÚ´æ²¼¾Ö£º¡¡
1***£»¡¡
1***£»¡¡
1111£»¡¡
****£¬11111111¡¡
ÕâÀïÓÐÈýµãºÜÖØÒª£º
Ê×ÏÈ£¬Ã¿¸ö³ÉÔ±·Ö±ð°´×Ô¼ºµÄ·½Ê½¶ÔÆ룻²¢ÄÜ×îС»¯³¤¶È¡£
Æä´Î£¬¸´ÔÓÀàÐÍ£¨Èç½á¹¹£©µÄĬÈ϶ÔÆ뷽ʽÊÇËü×µÄ³ÉÔ±µÄ¶ÔÆ뷽ʽ£»ÕâÑùÔÚ³ÉÔ±ÊǸ´ÔÓ
ÀàÐÍʱ£»¿ÉÒÔ×îС»¯³¤¶È¡£
È»ºó£¬¶ÔÆëºóµÄ³¤¶È±ØÐëÊdzÉÔ±ÖÐ×î´óµÄ¶ÔÆë²ÎÊýµÄÕûÊý±¶£»ÕâÑùÔÚ´¦ÀíÊý×éʱ¿ÉÒÔ±£
֤ÿһÏ±ß½ç¶ÔÆë¡£
²¹³äһϣ»¶ÔÓÚÊý×飻±ÈÈ磺char¡¡
a£§3£§£»ËüµÄ¶ÔÆ뷽ʽºÍ·Ö±ðд¡¡
3¸ö¡¡
charÊÇÒ»ÑùµÄ¡£Ò²¾ÍÊÇ˵
Ëü»¹ÊÇ°´¡¡
1¸ö×Ö½Ú¶ÔÆë¡£Èç¹ûд£º¡¡
typedef¡¡
charArray3£§3£§£»Array3ÕâÖÖÀàÐ͵ĶÔÆ뷽ʽ»¹ÊÇ°´¡¡
1
¸ö×Ö½Ú¶ÔÆ룻¶ø²»ÊÇ°´ËüµÄ³¤¶È¡£
µ«ÊDz»ÂÛÀàÐÍÊÇʲô£»¶ÔÆëµÄ±ß½çÒ»¶¨ÊÇ¡¡
1£»2£»4£»8£»16£»32£»64¡£¡£¡£¡£ÖеÄÒ»¸ö¡£
ÁíÍ⣬עÒâ±ðµÄ#pragma¡¡
packµÄÆäËûÓ÷¨£º¡¡
#pragma¡¡
pack£¨push£©¡¡
//±£´æµ±Ç°¶ÔÆ䷽ʽµ½¡¡
packingstack¡¡
#pragma¡¡
pack£¨push£»n£©µÈЧÓÚ¡¡
#pragma¡¡
pack£¨push£©¡¡
#pragma¡¡
pack£¨n£©¡¡
//n=1£»2£»4£»8£»16±£´æµ±Ç°¶ÔÆ뷽ʽ£¬ÉèÖð´¡¡
n×Ö½Ú¶ÔÆë¡¡
#pragmapack£¨pop£©¡¡
//packingstack³öÕ»£¬²¢½«¶ÔÆ䷽ʽÉèÖÃΪ³