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

CºÍC++ÖеÄÖ÷ÒªÊý¾ÝÀàÐͺÍ×Ö½Ú´óС

CºÍC++ÖеÄÖ÷ÒªÊý¾ÝÀàÐͺÍ×Ö½Ú´óС(
    C/C++µÄд·¨ÊDz»¿ÆѧºÍ²»ÑϽ÷µÄ¡£ÒòΪCºÍC++ËäÈ»ÓïÒ壬µ«ÊÇÉè¼Æ˼ÏëÊǽṹ»¯ÓëÃæÏò¶ÔÏó. C±ê×¼¹æ·¶ÓëC++µÄ±ê×¼¹æ·¶Ò²ÊÇÁ½¸öÎı¾¡£½üÀ´×ÐϸÑо¿ÁËËüÃǵÄÊý¾ÝÀàÐÍ£¬²ÅÖªµÀÆäÀ´ÁúÈ¥Âö£¬ÕæÕý×öµ½ÆäʵËùÒÔÈ»¡£
1¡¢CÓïÑÔ¶¨ÒåÁË5ÖÖ»ù±¾Êý¾ÝÀàÐÍ
  char(×Ö·û), int(ÕûÊý), float(µ¥¾«¶È), double(Ë«¾«¶È),void;
ÔÚ32λ»úÆ÷ÉÏ,sizeofµÄÆäÖµ·Ö±ðΪ£º
  sizeof(char)=1, sizeof(int)=4, sizeof(float)=4, sizeof(double)=8;
 sizeof(char*)=4;(ÈκÎÀàÐÍÖ¸Õë±äÁ¿Îª32λ¼´4¸ö×Ö½Ú)
2¡¢C++ÓïÑÔÓÚC»ù´¡ÉÏÔö¼Ó2ÖÖÊý¾ÝÀàÐÍ£º
 bool(²¼¶û),wchar_t(¿í×Ö·û);
ÔÚ32λ»úÆ÷ÉÏ,sizeofµÄÆäÖµ·Ö±ðΪ:
 sizeof(bool)=1, sizeof(wchar_t)=2, sizeof(bool*)=sizeof(wchar_t*)=4;
3¡¢Êý¾ÝÀàÐ͵Ļù±¾ÐÞÊηû:
  signed(ÓзûºÅ), unsigned(ÎÞ·ûºÅ),long(³¤Õû),short(¶ÌÕû)
4¡¢²âÊÔ´úÂë:
 size_t nchar=sizeof(char);
 size_t nfloat=sizeof(float);
 size_t ndouble=sizeof(double);
 size_t nint = sizeof(int);
 a.Format("CÓïÑÔÊý¾ÝÀàÐͳ¤¶È:char=%d,float=%d,double=%d,int=%d",nchar,nfloat,ndouble,nint);
 AfxMessageBox(a);
 nint = sizeof(int*);
 nchar = sizeof(char*);
 ndouble = sizeof(double*);
 nfloat = sizeof(float*);
 a.Format("CÓïÑÔÖ¸ÕëÀàÐͳ¤¶È:char*=%d,float*=%d,double*=%d,int*=%d",nchar,nfloat,ndouble,nint);
 AfxMessageBox(a);
 size_t nbool=sizeof(bool);
 size_t nwchar=sizeof(wchar_t);
 a.Format("C++ÐÂÔöÊý¾ÝÀàÐͳ¤¶È:bool=%d,wchar_t=%d,bool*=%d,wchar_t*=%d",nbool,nwchar,sizeof(bool*),sizeof(wchar_t*));
 AfxMessageBox(a);
5.Àí½â´úÂë
//A
  ²ÉÓÃ32λѰַ·½Ê½£¬ÔòÊý×échar**[4][4]Õ¼ÓÃ×Ö½Ú=4*4*4×Ö½Ú(32bit)=64×Ö½Ú
//B
#include   "stdio.h" 
  
  int   main() 
  { 
      int   *p; 
      printf("%d",   sizeof(p)); 
      return   0; 
  } 


Ïà¹ØÎĵµ£º

ÈçºÎʹÓ÷ºÐÍÄ£擬virtual? (C/C++) (template)

ÍøÉÏÒ»µÀ½ðɽµÄÃæÊÔÌ⣺
http://topic.csdn.net/u/20100524/14/0eff992a-2849-4db6-bdaa-d4a200e79b7c.html
Çë·Ö±ðÓÃC++µÄÃæÏò¶ÔÏóºÍ·ºÐÍ»úÖÆ£¬±àдʵÏÖTemplate MethodģʽµÄʾÀý´úÂ룬²¢±È½ÏÁ½ÖÖ·½Ê½¸÷×ÔµÄÓÅȱµã¡£
ÓÃÐ麯ÊýʵÏÖTemplate MethodµÄ·½Ê½¾Í²»¶à˵ÁË¡£Ó÷ºÐ͵ķ½Ê½ÊµÏÖ¶à̬ÔÚATLÀïÃæÓдóÁ¿µÄÓõ½£¡
·ºÐ͵ ......

²Ù×÷ϵͳѧϰ±Ê¼Ç(14) CºÍ»ã±àÏ໥µ÷ÓÃ

; ±àÒëÁ´½Ó·½·¨
; (ld µÄ‘-s’Ñ¡ÏîÒâΪ“strip all”)
; gcc -c not link
;
; [root@XXX XXX]# nasm -f elf foo.asm -o foo.o
; [root@XXX XXX]# gcc -c bar.c -o bar.o
; [root@XXX XXX]# ld -s foo.o bar.o -o foobar
; [root@XXX XXX]# ./foobar
; the 2nd one
; [root@XXX XXX]#
exter ......

C/C++ÖеÄÈÕÆÚºÍʱ¼ä

ͻ񻣼
±¾ÎÄ´Ó½éÉÜ»ù´¡¸ÅÄîÈëÊÖ£¬Ì½ÌÖÁËÔÚC/C++ÖжÔÈÕÆÚºÍʱ¼ä²Ù×÷ËùÓõ½µÄÊý¾Ý½á¹¹ºÍº¯Êý£¬²¢¶Ô¼Æʱ¡¢Ê±¼äµÄ»ñÈ¡¡¢Ê±¼äµÄ¼ÆËãºÍÏÔʾ¸ñʽµÈ·½Ãæ½øÐÐÁ˲ûÊö¡£±¾ÎÄ»¹Í¨¹ý´óÁ¿µÄʵÀýÏòÄãչʾÁËtime.hÍ·ÎļþÖÐÉùÃ÷µÄ¸÷ÖÖº¯ÊýºÍÊý¾Ý½á¹¹µÄÏêϸʹÓ÷½·¨¡£
¹Ø¼ü×Ö£ºUTC£¨ÊÀ½ç±ê׼ʱ¼ä£©£¬Calendar Time£¨ÈÕÀúʱ¼ä£©£¬epoch£¨Ê±¼ä ......

ÉîÈëC/C++Ö®»ùÓÚCheckStackVarsµÄ°²È«¼ì²é£¨VS2008£©

×î½üһֱæ±ÏÒµµÄÏà¹ØÊÂÇ飬¼ÓÉϹ¤×÷£¬×ªÑۼ䣬ÓÖµ½Ôµ×ÁË£¬Ö®Ç°³ÐŵµÄÿÔÂһƪ²©ÎÄ£¬Ç°¼¸Ìì¾ÍÒ»Ö±ÔÚÑ°ÕÒµ½µ×Ҫдʲô£¬½üÁ½ÌìÓÖͻȻ·¢ÏÖÓкܶණÎ÷¿ÉÒÔд¡£±¾Æª¾ÍÏÈÑÓÐø֮ǰµÄһƪ»ùÓÚCookieµÄ°²È«¼ì²é»úÖÆ£¨ÉîÈëC/C++Ö®»ùÓÚCookieµÄ°²È«¼ì²é£¨VS2005£©£©À´½éÉÜÏÂÁíÍâÒ»ÖÖÔÚDEBUG°æ±¾Ïµİ²È«¼ì²é£¬Ò²¾ÍÊÇCheckStackVars¼ì ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ