Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

C/C++ ×Ö½Ú¶ÔÆëÎÊÌâ

VCÖÐÏÂÃ漸¸ö½á¹¹Ìå´óС·Ö±ðÊǶàÉÙÄØ
struct MyStruct
{
    double m4;
    char m1;
    int m3£»
};
struct MyStruct {
    char m1;
    double m4;
    int m3;
};
#pragma pack(push)   //±£´æ¶ÔÆë״̬
#pragma pack(16)      //ÉèÖÃΪ16×Ö½Ú¶ÔÆë
struct test
{
   char m1;
   int m3;
   double m4;    
};
#pragma pack(pop)//»Ö¸´¶ÔÆë״̬
Èç¹ûÄãµÄ´ð°¸²»ÊÇ16£¬24ºÍ16£¬ÏàÐÅÏÂÃæµÄÄÚÈݶÔÄãºÜÓаïÖú¡£
1¡¢sizeofÓ¦ÓÃÔڽṹÉϵÄÇé¿ö
Çë¿´ÏÂÃæµÄ½á¹¹£º
struct MyStruct
{
    double dda1;
    char dda;
    int type
};
¶Ô½á¹¹MyStruct²ÉÓÃsizeof»á³öÏÖʲô½á¹ûÄØ£¿sizeof(MyStruct)Ϊ¶àÉÙÄØ£¿Ò²ÐíÄã»áÕâÑùÇó£º
sizeof(MyStruct)=sizeof(double)+sizeof(char)+sizeof(int)=13
µ«Êǵ±ÔÚVCÖвâÊÔÉÏÃæ½á¹¹µÄ´óСʱ£¬Äã»á·¢ÏÖsizeof(MyStruct)Ϊ16¡£ÄãÖªµÀΪʲôÔÚVCÖлáµÃ³öÕâÑùÒ»¸ö½á¹ûÂð£¿
Æäʵ£¬ÕâÊÇVC¶Ô±äÁ¿´æ´¢µÄÒ»¸öÌØÊâ´¦Àí¡£ÎªÁËÌá¸ßCPUµÄ´æ´¢Ëٶȣ¬VC¶ÔһЩ±äÁ¿µÄÆðʼµØÖ·×öÁË“¶ÔÆë”´¦Àí¡£
        ¢ÙÔÚĬÈÏÇé¿öÏ£¬VC¹æ¶¨½á¹¹Ìå¸÷³ÉÔ±±äÁ¿´æ·ÅµÄÆðʼµØÖ·Ïà¶ÔÓڽṹµÄÆðʼµØÖ·µÄÆ«ÒÆÁ¿±ØÐëΪ¸Ã±äÁ¿µÄÀàÐÍËùÕ¼ÓõÄ×Ö½ÚÊýµÄ±¶Êý¡£
ÏÂÃæÁгö³£ÓÃÀàÐ͵ĶÔÆ뷽ʽ(vc6.0,32λϵͳ)¡£
ÀàÐÍ           ¶ÔÆ뷽ʽ£¨±äÁ¿´æ·ÅµÄÆðʼµØÖ·Ïà¶ÔÓڽṹµÄÆðʼµØÖ·µÄÆ«ÒÆÁ¿£©
Char          Æ«ÒÆÁ¿±ØÐëΪsizeof(char)¼´1µÄ±¶Êý
Short         Æ«ÒÆÁ¿±ØÐëΪsizeof(short)¼´2µÄ±¶Êý
int      Æ«ÒÆÁ¿±ØÐëΪsizeof(int)¼´4µÄ±¶Êý
float Æ«ÒÆÁ¿±ØÐëΪsizeof(float)¼´4µÄ±¶Êý
double Æ«ÒÆÁ¿±ØÐëΪsizeof(double)¼´8µÄ±¶Êý
¸÷³ÉÔ±±äÁ¿ÔÚ´æ·ÅµÄʱºò¸ù¾ÝÔڽṹÖгöÏÖµÄ˳ÐòÒÀ´ÎÉêÇë¿Õ¼ä£¬Í¬Ê±°´ÕÕÉÏÃæµÄ¶ÔÆ뷽ʽµ÷ÕûλÖ㬿ÕȱµÄ×Ö½ÚVC»á×Ô¶¯Ìî³ä¡£
         ¢Ú ͬʱVCΪÁËÈ·±£½á¹¹µ


Ïà¹ØÎĵµ£º

C++´¦ÀíconstÀàÐͱäÁ¿ÓëCµÄ²»Í¬

    constÓë#define×î´óµÄ²î±ð£¬ConstÔÚ¶ÑÕ»·ÖÅäÁ˿ռ䣬¶ø#defineÖ»ÊǰѾßÌåÊýÖµÖ±½Ó´«µÝµ½Ä¿±ê±äÁ¿°ÕÁË¡£»òÕß˵£¬constµÄ³£Á¿ÊÇÒ»¸öRun-TimeµÄ¸ÅÄËûÔÚ³ÌÐòÖÐȷȷʵʵµÄ´æÔÚ¿ÉÒÔ±»µ÷Óᢴ«µÝ¡£¶ø#define³£Á¿ÔòÊÇÒ»¸öCompile-Time¸ÅÄËüµÄÉúÃüÖÜÆÚÖ¹ÓÚ±àÒëÆÚ£ºÔÚʵ¼Ê³ÌÐòÖÐËûÖ»ÊÇÒ»¸ö³£Êý¡¢Ò»¸öÃüÁîÖе ......

¶ÑÕ»µÄC´úÂëʵÏÖ

2009-09-13     16:42:43  
 ½ñÌìʵÏÖ¶ÑÕ»½á¹¹²¿·ÖµÄ´úÂ룬²¢ÓÃÒ»¼òµ¥³ÌÐò²âÊԳɹ¦¡£
stack.h:
#ifndef _STACK_H_
#define _STACK_H_
#include <stdio.h>
#include <stdlib.h>
#include <memory.h>
#define STACK_INIT_SIZE 5
#define STACKINCREMENT 5
t ......

¹¹½¨×Ô¼ºµÄC/C++²å¼þ¿ª·¢¿ò¼Ü——ϵÁÐ

ÕâһϵÁÐÎÄÕÂÊÇÎÒ¹¹½¨C/C++²å¼þ¿ª·¢¿ò¼Ü¿ª·Å¿ò¼ÜµÄ¹ý³Ì¡£ºóÃæ»áÒ»Ö±¸üУ¬Ö±ÖÁ¹¹½¨Íê³É¡£
¡¶¹¹½¨×Ô¼ºµÄC/C++²å¼þ¿ª·¢¿ò¼Ü£¨Ò»£©——³õ²½ÉèÏë¡·
¡¶¹¹½¨×Ô¼ºµÄC/C++²å¼þ¿ª·¢¿ò¼Ü£¨¶þ£©——×ÜÌ幦ÄÜ¡·
¡¶
¹¹½¨×Ô¼ºµÄC/C++²å¼þ¿ª·¢¿ò¼Ü£¨Èý£©——×ÜÌå½á¹¹
¡·
¡¶¹¹½¨×Ô¼ºµÄC/C++²å¼þ¿ª·¢¿ò¼ ......

ECLIPSE ¿ª·¢ C/C++ ¹¤³Ì

  ×î½üÒ»¸öÅóÓÑ×¼±¸°ÑC´úÂëÔÚECLIPSEÉϱàÒ룬ÒÔÇ°Ò»Ö±¸ãµÄJAVA£¬Ò²ÖªµÀECLIPSEÖ§³ÖC¹¤³Ì£¬µ«ÊÇ×Ô¼º´ÓÀ´Ã»¸ã¹ý£¬ËùÒÔ¾Í×Ô¼ºÏÈ´ÓÍøÂçÉÏÕÒ×ÊÁÏ£¬Ö÷Òª·½·¨ÈçÏÂ
1¡¢°²×°JDKºÍEclipse
ÕâÀï¾Í²»¶à˵£¬¾ßÌåÇë¼û£ºhttp://blog.chinaunix.net/u/16292/showart_223309.html
Îҵݲװ»·¾³ÊÇjdk1.5£¬eclipse3.2.1
2¡¢°²×°C++µÄE ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ