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

ÈçºÎÀí½âC run

ÈçºÎÀí½âC run-time library £¨CÔËÐÐʱ¿â£©
×¢£º ÒÔÏÂÄÚÈݲ¿·ÖÒý×ÔCSNDÖÐÏà¹ØÌÖÂÛµÄÌû×Ó£¬²¢½áºÏ×Ô¼ºµÄÀí½âÕûÀí¶ø³É¡£½ö¹©²Î¿¼¡£
1)ÔËÐÐʱ¿â¾ÍÊÇ C run-time library£¬ÊÇ C ¶ø·Ç C++ ÓïÑÔÊÀ½çµÄ¸ÅÄî:È¡Õâ¸öÃû×Ö¾ÍÊÇÒòΪÄãµÄ C ³ÌÐòÔËÐÐʱÐèÒªÕâЩ¿âÖеĺ¯Êý.
2)C ÓïÑÔÊÇËùνµÄ“СÄں˔ÓïÑÔ£¬¾ÍÆäÓïÑÔ±¾ÉíÀ´ËµºÜС£¨²»¶àµÄ¹Ø¼ü×Ö£¬³ÌÐòÁ÷³Ì¿ØÖÆ£¬Êý¾ÝÀàÐ͵ȣ©£»ËùÒÔ£¬C ÓïÑÔÄں˿ª·¢³öÀ´Ö®ºó£¬Dennis Ritchie ºÍ Brian Kernighan ¾ÍÓà C ±¾ÉíÖØдÁË 90% ÒÔÉ쵀 UNIX ϵͳº¯Êý£¬²¢ÇÒ°ÑÆäÖÐ×î³£ÓõIJ¿·Ö¶ÀÁ¢³öÀ´£¬ÐγÉÍ·ÎļþºÍ¶ÔÓ¦µÄ LIBRARY£¬C run-time library ¾ÍÊÇÕâÑùÐγɵġ£
3) Ëæºó£¬Ëæ×Å C ÓïÑÔµÄÁ÷ÐУ¬¸÷¸ö C ±àÒëÆ÷µÄÉú²úÉÌ/¸öÌå/ÍÅÌ嶼×ñÑ­ÀϵĴ«Í³£¬ÔÚ²»Í¬Æ½Ì¨É϶¼ÓÐÏà¶ÔÓ¦µÄ Standard Library£¬µ«´ó²¿·ÖʵÏÖ¶¼ÊÇÓë¸÷¸öƽ̨Óйصġ£ÓÉÓÚ¸÷¸ö C ±àÒëÆ÷¶Ô C µÄÖ§³ÖºÍÀí½âÓкܶà·ÖÆçºÍ΢ÃîµÄ²î±ð£¬ËùÒÔ¾ÍÓÐÁË ANSI C£»ANSI C £¨Ö÷¹ÛÒâͼÉÏ£©ÏêϸµÄ¹æ¶¨ÁË C ÓïÑÔ¸÷¸öÒªËصľßÌ庬ÒåºÍ±àÒëÆ÷ʵÏÖÒªÇó£¬Òý½øÁËеĺ¯ÊýÉùÃ÷·½Ê½£¬Í¬Ê±¶©Á¢ÁË Standard Library µÄ±ê×¼ÐÎʽ¡£ËùÒÔCÔËÐÐʱ¿âÓɱàÒëÆ÷Éú²úÉÌÌṩ¡£ÖÁÓÚÓÉÆäËû³§ÉÌ/¸öÈË/ÍÅÌåÌṩµÄÍ·ÎļþºÍ¿âº¯Êý£¬Ó¦µ±³ÆΪµÚÈý·½ C ÔËÐп⣨Third party C run-time libraries£©¡£
4)C run-time libraryÀïÃ溬Óгõʼ»¯´úÂ룬»¹ÓдíÎó´¦Àí´úÂë(ÀýÈçdivide by zero´¦Àí)¡£ÄãдµÄ³ÌÐò¿ÉÒÔûÓÐmath¿â£¬³ÌÐòÕÕÑùÔËÐУ¬Ö»ÊDz»ÄÜ´¦Àí¸´ÔÓµÄÊýѧÔËË㣬²»¹ýÈç¹ûûÓÐÁËC run-time¿â£¬main()¾Í²»»á±»µ÷Óã¬exit()Ò²²»Äܱ»ÏìÓ¦¡£ÒòΪC run-time library°üº¬ÁËC³ÌÐòÔËÐеÄ×î»ù±¾ºÍ×î³£Óõĺ¯Êý¡£
5) µ½ÁË C++ ÊÀ½çÀÓÐÁíÍâÒ»¸ö¸ÅÄî:Standard C++ Library,Ëü°üÀ¨ÁËÉÏÃæËù˵µÄ C run-time library ºÍ STL¡£°üº¬ C run-time library µÄÔ­ÒòºÜÃ÷ÏÔ£¬C++ ÊÇ C µÄ³¬¼¯£¬Ã»ÓÐÀíÓÉÔÙÖØÐÂÀ´Ò»¸ö C++ run-time library. VCÕë¶ÔC++ ¼ÓÈëµÄStandard C++ LibraryÖ÷Òª°üÀ¨£ºLIBCP.LIB, LIBCPMT.LIBºÍ MSVCPRT.LIB
6)Windows»·¾³Ï£¬VCÌṩµÄ C run-time libraryÓÖ·ÖΪ¶¯Ì¬ÔËÐÐʱ¿âºÍ¾²Ì¬ÔËÐÐʱ¿â¡£
¶¯Ì¬ÔËÐÐʱ¿âÖ÷ÒªÊÇDLL¿âÎļþmsvcrt.dll(or MSVCRTD.DLL for debug build),¶ÔÓ¦µÄImport libraryÎļþÊÇMSVCRT.LIB(MSVCRTD.LIB for debug build)
¾²Ì¬ÔËÐÐʱ¿â(release°æ)¶ÔÓ¦µÄÖ÷ÒªÎļþÊÇ£º
LIBC.LIB (Single thread static library, retail version)
LIBCMT.LIB (Multithread static library, retail versio


Ïà¹ØÎĵµ£º

Delphi Óë C/C++ Êý¾ÝÀàÐͶÔÕÕ±í

Delphi Óë C/C++ Êý¾ÝÀàÐͶÔÕÕ±í
DelphiÊý¾ÝÀàÐÍC/C++
ShorInt
8λÓзûºÅÕûÊý
char
Byte
8λÎÞ·ûºÅÕûÊý
BYTE,unsigned short
SmallInt
16λÓзûºÅÕûÊý
short
Word
16λÎÞ·ûºÅÕûÊý
unsigned short
Integer,LongInt
32λÓзûºÅÕûÊý
int,long
Cardinal,LongWord/DWORD
32λÎÞ·ûºÅÕûÊý
unsigned long
Int6 ......

C traps and Puzzles

ÏÂÃæµÄÀý×Ó¶¼ÔÚUbuntu8.04 GCCϱàÒëµÄ½á¹û£¬ÓÐЩûÓиø½á¹û
±à³ÌÒ»¶¨Òª×Ô¼º¶¯ÊÖÊÔÒ»ÊÔ£¡
1.¶¨ÒåÓëÉùÃ÷£¬¶¨ÒåÒª·ÖÅäÄڴ棬ÉùÃ÷Ö»ÊÇÉùÃ÷Ôڱ𴦶¨ÒåÁË
int a;     //¶¨Òå
extern int a;  //ÉùÃ÷
char str[100]
extern char str[]  //ok
char * str[]
extern char str[] //error
char ......

½«Àà³ÉÔ±º¯ÊýÓÃ×÷C»Øµ÷º¯Êý

½«Àà³ÉÔ±º¯ÊýÓÃ×öC»Øµ÷º¯Êý
Ìá³öÎÊÌ⣺
    »Øµ÷º¯ÊýÊÇ»ùÓÚC±à³ÌµÄWindows SDKµÄ¼¼Êõ£¬²»ÊÇÕë¶ÔC++µÄ£¬³ÌÐòÔ±¿ÉÒÔ½«Ò»¸öCº¯ÊýÖ±½Ó×÷Ϊ»Øµ÷º¯Êý£¬µ«ÊÇÈç¹ûÊÔͼֱ½ÓʹÓÃC++µÄ³ÉÔ±º¯Êý×÷Ϊ»Øµ÷º¯Êý½«·¢Éú´íÎó£¬ÉõÖÁ±àÒë¾Í²»ÄÜͨ¹ý¡£
·ÖÎöÔ­Òò£º
    ÆÕͨµÄC++³ÉÔ±º¯Êý¶¼Òþº¬ÁËÒ»¸ö´«µÝº¯Êý ......

cÖ¸ÕëµÄ¸÷ÖÖÓ÷¨ÊÔÑé

#include <iostream.h>
void fun0(int* p)
{
int* a=new int[3];
*a=0;
*(a+1)=1;
*(a+2)=2;
p=a;
}
void fun1(int* &p)
{
int* a=new int[3];
*a=0;
*(a+1)=1;
*(a+2)=2;
p=a;
}
void fun2(int* p)
{
*p=0;
*(p+1)=1;
*(p+2)=2;
}
//warning:returning address of local va ......

C/C++³ÌÐòÄÚ´æÖÐÊý¾Ý´æ´¢Çø·ÖÀà

    ÔÚC/C++ÖУ¬ÄÚ´æÖÐÊý¾Ý´æ´¢·Ö³É4¸öÇø£¬·Ö±ðÊǶѡ¢Õ»¡¢È«¾Ö/¾²Ì¬´æ´¢ÇøºÍ³£Á¿´æ´¢Çø¡£
      Õ»(stack)£¬¾ÍÊÇÄÇЩÓɱàÒëÆ÷ÔÚÐèÒªµÄʱºò·ÖÅ䣬ÔÚ²»ÐèÒªµÄʱºò×Ô¶¯Çå³ýµÄ±äÁ¿µÄ´æ´¢Çø¡£ÀïÃæµÄ±äÁ¿Í¨³£ÊǾֲ¿±äÁ¿¡¢º¯Êý²ÎÊýµÈ¡£
      ¶Ñ(heap)£¬Ò»°ãÓ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ