ÒÀÈ»CÄÚ´æ
Ò». ÔÚcÖзÖΪÕ⼸¸ö´æ´¢Çø
1.Õ» - ÓɱàÒëÆ÷×Ô¶¯·ÖÅäÊÍ·Å
2.¶Ñ - Ò»°ãÓɳÌÐòÔ±·ÖÅäÊÍ·Å£¬Èô³ÌÐòÔ±²»ÊÍ·Å£¬³ÌÐò½áÊøʱ¿ÉÄÜÓÉOS»ØÊÕ
3.È«¾ÖÇø£¨¾²Ì¬Çø£©£¬È«¾Ö±äÁ¿ºÍ¾²Ì¬±äÁ¿µÄ´æ´¢ÊÇ·ÅÔÚÒ»¿éµÄ£¬³õʼ»¯µÄÈ«¾Ö±äÁ¿ºÍ¾²Ì¬±äÁ¿ÔÚÒ»¿éÇøÓò£¬Î´³õʼ»¯µÄÈ«¾Ö±äÁ¿ºÍδ³õʼ»¯µÄ¾²Ì¬±äÁ¿ÔÚÏàÁÚµÄÁíÒ»¿éÇøÓò¡£- ³ÌÐò½áÊøÊÍ·Å
4.ÁíÍ⻹ÓÐÒ»¸öרÃŷų£Á¿µÄµØ·½¡£- ³ÌÐò½áÊøÊÍ·Å
ÔÚº¯ÊýÌåÖж¨ÒåµÄ±äÁ¿Í¨³£ÊÇÔÚÕ»ÉÏ£¬ÓÃmalloc, calloc, reallocµÈ·ÖÅäÄÚ´æµÄº¯Êý·ÖÅäµÃµ½µÄ¾ÍÊÇÔÚ¶ÑÉÏ¡£ÔÚËùÓк¯ÊýÌåÍⶨÒåµÄÊÇÈ«¾ÖÁ¿£¬¼ÓÁËstaticÐÞÊηûºó²»¹ÜÔÚÄÄÀﶼ´æ·ÅÔÚÈ«¾ÖÇø£¨¾²Ì¬Çø£©,ÔÚ ËùÓк¯ÊýÌåÍⶨÒåµÄstatic±äÁ¿±íʾÔÚ¸ÃÎļþÖÐÓÐЧ£¬²»ÄÜexternµ½±ðµÄÎļþÓã¬ÔÚº¯ÊýÌåÄÚ¶¨ÒåµÄstatic±íʾֻÔڸú¯ÊýÌåÄÚÓÐЧ¡£ÁíÍ⣬º¯ ÊýÖеÄ"adgfdf"ÕâÑùµÄ×Ö·û´®´æ·ÅÔÚ³£Á¿Çø¡£±ÈÈ磺
int a = 0; //È«¾Ö³õʼ»¯Çø
char *p1; //È«¾Öδ³õʼ»¯Çø
void main()
{
int b; //Õ»
char s[] = "abc"; //Õ»
char *p2; //Õ»
char *p3 = "123456"; //123456{post.content}ÔÚ³£Á¿Çø£¬p3ÔÚÕ»ÉÏ
static int c = 0; //È«¾Ö£¨¾²Ì¬£©³õʼ»¯Çø
p1 = (char *)malloc(10); //·ÖÅäµÃÀ´µÃ10×Ö½ÚµÄÇøÓòÔÚ¶ÑÇø
p2 = (char *)malloc(20); //·ÖÅäµÃÀ´µÃ20×Ö½ÚµÄÇøÓòÔÚ¶ÑÇø
strcpy(p1, "123456");
//123456{post.content}·ÅÔÚ³£Á¿Çø£¬±àÒëÆ÷¿ÉÄܻὫËüÓëp3ËùÖ¸ÏòµÄ"123456"ÓÅ»¯³ÉÒ»¿é
}
¶þ.ÔÚC++ÖУ¬ÄÚ´æ·Ö³É5¸öÇø£¬ËûÃÇ·Ö±ðÊǶѡ¢Õ»¡¢×ÔÓÉ´æ´¢Çø¡¢È«¾Ö/¾²Ì¬´æ´¢ÇøºÍ³£Á¿´æ´¢Çø
1.Õ»£¬¾ÍÊÇÄÇЩÓɱ
Ïà¹ØÎĵµ£º
CµÄstaticµÄÓ÷¨:
1.¶ÔÓÚº¯ÊýÀïµÄ¾Ö²¿±äÁ¿,¸Ä±äµÄÊÇËüµÄÉú´æÖÜÆÚ,Õâ¸ö±äÁ¿»áÒ»Ö±´æÔÚ,µ½³ÌÐò½áÊø. º¯ÊýÍⲿ·ÃÎʲ»µ½Õâ¸ö±äÁ¿.
2.¶ÔÓÚÈ«¾ÖµÄ±äÁ¿,¸Ä±äµÄÊÇËüµÄ×÷Ó÷¶Î§,Õâ¸ö±äÁ¿Ö»ÔÚ±¾ÎļþÄÚÓÐЧ.ÆäËüµÄ.cÎļþ¿´²»µ½.
µ±È»ËüµÄÉúÃüÖÜÆÚÊǺͳÌÐòÒ»ÑùµÄ ......
ת
ÔØ×Ôhttp://www.builder.com.cn/
static
ÊÇc++Öкܳ£ÓõÄÐÞÊηû£¬Ëü±»ÓÃÀ´¿ØÖƱäÁ¿µÄ´æ´¢·½Ê½ºÍ¿É¼ûÐÔ£¬ÏÂÃæÎÒ½«´Ó static ÐÞÊηûµÄ²úÉúÔÒò¡¢×÷ÓÃ̸Æð£¬È«Ãæ·ÖÎöstatic
ÐÞÊηûµÄʵÖÊ¡£
¡¡¡¡static µÄÁ½´ó×÷ÓÃ:
¡¡¡¡Ò»¡¢¿ØÖÆ´æ´¢·½Ê½£º
¡¡¡¡static±»ÒýÈëÒÔ¸æÖª±àÒëÆ÷£¬½«±ä ......
×öµ½×¨Òµ£¬Ó¦¸ÃÊÇÿ¸öÖ°Òµ³ÌÐòÔ±Ó¦¸ÃÒªÇó×Ô¼º×öµ½µÄ¡£
ÈÃÎÒÃÇ¿´¿´lua
ÊÇ
ÔõôдͷÎļþµÄ¡£
1.License Agreement
License
Agreement
Ó¦¸Ã¼ÓÔÚÿ¸öÍ·ÎļþµÄ¶¥²¿¡£
Lua Sample:
/*
** $Id: lua.h,v 1.175b 2003/03/18 12:31:39 roberto Exp $
** Lua - An ......
C/C++ÊÇ×îÖ÷ÒªµÄ±à³ÌÓïÑÔ¡£ÕâÀïÁгöÁË50ÃûÓÅÐãÍøÕ¾ºÍÍøÒ³Çåµ¥£¬ÕâЩÍøÕ¾Ìṩc/c++Ô´´úÂë¡£Õâ·ÝÇåµ¥ÌṩÁËÔ´´úÂëµÄÁ´½ÓÒÔ¼°ËüÃǵÄС˵Ã÷¡£ÎÒÒѾ¡Á¦°üÀ¨×î¼ÑµÄC/C++Ô´´úÂëµÄÍøÕ¾¡£Õâ²»ÊÇÒ»¸öÍêÕûµÄÇåµ¥£¬ÄúÓн¨Òé¿ÉÒÔÁªÏµÎÒ£¬ÎÒ½«»¶ÓÄúµÄ½¨Ò飬ÒÔ½øÒ»²½¼ÓÇ¿Õâ·½ÃæµÄÇåµ¥¡£
1¡¢http://snippets.dzone.com/tag/c/ --ÊýÒÔǧ¼Æ ......
ÔÚ´Ëժ¼C±àÒëʱ³öÏֵľ¯¸æÐÅÏ¢µÄÒâÒå¡£
1) warning: ISO C90 forbids mixed declarations and code
CÓïÑÔÊÇÃæÏò¹ý³ÌµÄÓïÑÔ£¬Õâ¸ö¾¯¸æͨ³£±íʾÉùÃ÷Ó¦¸ÃÔÚÆäËû´úÂëµÄÇ°Ãæ¡£
2) warning: initialization from incompatible pointer type
ÔÚLinux kernelÖÐÓÐÐí¶àcallbackº¯Êý£¬Õâ¸ö¾¯¸æ±íÃ÷callbackº¯ÊýµÄʵÏÖÖУ¬»òÕß·µ ......