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;
}
Ïà¹ØÎĵµ£º
ÍøÉÏÒ»µÀ½ðɽµÄÃæÊÔÌ⣺
http://topic.csdn.net/u/20100524/14/0eff992a-2849-4db6-bdaa-d4a200e79b7c.html
Çë·Ö±ðÓÃC++µÄÃæÏò¶ÔÏóºÍ·ºÐÍ»úÖÆ£¬±àдʵÏÖTemplate MethodģʽµÄʾÀý´úÂ룬²¢±È½ÏÁ½ÖÖ·½Ê½¸÷×ÔµÄÓÅȱµã¡£
ÓÃÐ麯ÊýʵÏÖTemplate MethodµÄ·½Ê½¾Í²»¶à˵ÁË¡£Ó÷ºÐ͵ķ½Ê½ÊµÏÖ¶à̬ÔÚATLÀïÃæÓдóÁ¿µÄÓõ½£¡
·ºÐ͵ ......
ÏÂÃæ˵µ½µÄCÓïÑÔÖеÄ֪ʶ£¬ÎÒÖ»ÊÇÔÚ¹¤×÷Öо³£¼ûµ½»òÓõ½£¬µ«´ÓδÉΪʲô£¬½ñÌì²ÅÈ´µÀÔÀ´¼ò¼òµ¥µ¥ÏÂÃæÔÐÓýÕâÎÞÇîµÄ֪ʶµãºÍÎÒµÄäµã£¬ÊǸñßѧϰ±ß¼Ç¼ÁË¡£
Ô¤´¦ÀíÆ÷£¨Preprocessor£©
1 . ÓÃÔ¤´¦ÀíÖ¸Áî#define ÉùÃ÷Ò»¸ö³£Êý£¬ÓÃÒÔ±íÃ÷1ÄêÖÐÓжàÉÙÃ루ºöÂÔÈòÄêÎÊÌ⣩
#define ......
ÒÔϵÄ×ö·¨ÕûÀí×ÔÂÛ̳ÉϵÄÌû×Ó¡£
ÈçºÎcreate´óÎļþ
Òª´ó¾Í·Ç³£´ó£¬1T°É¡£
ÓÐÁ½ÖÖ·½·¨£º
Ò».dd
dd if=/dev/zero of=1T.img bs=1G seek=1024 count=0
bs=1G±íʾÿһ´Î¶Áд1GÊý¾Ý£¬count=0±íʾ¶Áд0´Î£¬seek=1024±íʾÂÔ¹ý1024¸öBlock²»Ð´£¬Ç°Ãæblock sizeÊÇ1G£¬ËùÒÔ¹²ÂÔ¹ý1T£¡
ÕâÊÇ´´½¨´óÐÍsparseÎļþ×î¼ ......
±àÒëÒ»¸öͼÏó½Ó¿Ú¿â£¬ÆäÖÐÓõ½cvSaveImage( out_img_name, img); ±àÒ뱨´í£º
too few arguments to function cvSaveImage
Ò»ÏÂ×ӾͺýÍ¿ÁË£¬´ÓÀ´¶¼ÊÇÕâôÓà cvSaveImage µÄ¡£highgui.hÀïµÄº¯ÊýÔÐÍÒ²ÊǶ¨ÒåÁËȱʡµÄ£¬
CVAPI(int) cvSaveImage(const char* filename, const CvArr* image, const int* params CV_DEFA ......
ÔÚ Web Ó¦ÓóÌÐò»·¾³ÖУ¬µü´úÖ÷ÒªÓÃÓڷôæºÍÏÔʾÊý¾Ý¼¯£¬Í¨³£ÊÇÒÔÁбí»ò±íÖеÄһϵÁÐÐеÄÐÎʽÏÔʾ¡£ÊµÏÖµü´úÄÚÈݵÄÖ÷Òª JSTL ²Ù×÷ÊÇ <c:forEach>; ¶¨ÖƱê¼Ç¡£¸Ã±ê¼ÇÖ§³ÖÁ½ÖÖ²»Í¬ÑùʽµÄµü´ú£ºÕûÊý·¶Î§Éϵĵü´ú£¨ÀàËÆ Java ÓïÑ﵀ for Óï¾ä£©ºÍ¼¯ºÏÉϵĵü´ú£¨ÀàËÆ Java ÓïÑ﵀ Iterator ºÍ Enumeration Àࣩ¡£
½øÐÐÕûÊ ......