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

¹ØÓÚC/C++ÖÐÄÚ´æ¿Õ¼äµÄ»®·Ö

CAPTION: ¹ØÓÚC/C++ÖÐÄÚ´æ¿Õ¼äµÄ»®·Ö
AUTHOR: aIsland Õª×ÔÖйúITʵÑéÊÒ
DATE: 2010-05-30
E-MAIL: aIsland@live.cn
QQ: 418662213
P.S.
     1.Bolanlan|ËæÐÄhigh|aIsland Èý¸öÍøÃû¾ùΪ±¾ÈË
     2.ÉùÃ÷aIsland ËùÊÕ¼µÄËùÓÐÎÄÕÂÆäÖø×÷Ȩ¶¼ÊôÓÚÔ­´´×÷Õß
     3.ÒýÓÃÎÄÕÂÁ´½Ó£ºhttp://c.chinaitlab.com/system/792799.html
Ò»¡¢Ò»¸ö¾­¹ý±àÒëµÄC/C++µÄ³ÌÐòÕ¼ÓõÄÄÚ´æ·Ö³ÉÒÔϼ¸¸ö²¿·Ö£º
¡¡¡¡1¡¢Õ»Çø£¨stack£©£ºÓɱàÒëÆ÷×Ô¶¯·ÖÅäºÍÊÍ·Å £¬´æ·Åº¯ÊýµÄ²ÎÊýÖµ¡¢¾Ö²¿±äÁ¿µÄÖµµÈ£¬ÉõÖÁº¯ÊýµÄµ÷Óùý³Ì¶¼ÊÇÓÃÕ»À´Íê³É¡£Æä²Ù×÷·½Ê½ÀàËÆÓÚÊý¾Ý½á¹¹ÖеÄÕ»¡£
¡¡¡¡2¡¢¶ÑÇø£¨heap£© £ºÒ»°ãÓɳÌÐòÔ±ÊÖ¶¯ÉêÇëÒÔ¼°ÊÍ·Å£¬ Èô³ÌÐòÔ±²»ÊÍ·Å£¬³ÌÐò½áÊøʱ¿ÉÄÜÓÉOS»ØÊÕ ¡£×¢ÒâËüÓëÊý¾Ý½á¹¹ÖеĶÑÊÇÁ½»ØÊ£¬·ÖÅ䷽ʽÀàËÆÓÚÁ´±í¡£
¡¡¡¡3¡¢È«¾ÖÇø£¨¾²Ì¬Çø£©£¨static£©£ºÈ«¾Ö±äÁ¿ºÍ¾²Ì¬±äÁ¿µÄ´æ´¢ÊÇ·ÅÔÚÒ»¿éµÄ£¬³õʼ»¯µÄÈ«¾Ö±äÁ¿ºÍ¾²Ì¬±äÁ¿ÔÚÒ»¿éÇøÓò£¬ δ³õʼ»¯µÄÈ«¾Ö±äÁ¿ºÍδ³õʼ»¯µÄ¾²Ì¬±äÁ¿ÔÚÏàÁÚµÄÁíÒ»¿éÇøÓò¡£³ÌÐò½áÊøºóÓÉϵͳÊͷſռ䡣
¡¡¡¡4¡¢ÎÄ×Ö³£Á¿Çø£º³£Á¿×Ö·û´®¾ÍÊÇ·ÅÔÚÕâÀïµÄ¡£ ³ÌÐò½áÊøºóÓÉϵͳÊͷſռ䡣
¡¡¡¡5¡¢³ÌÐò´úÂëÇø£º´æ·Åº¯ÊýÌåµÄ¶þ½øÖÆ´úÂë¡£
¡¡¡¡ÏÂÃæµÄÀý×Ó¿ÉÒÔÍêȫչʾ²»Í¬µÄ±äÁ¿ËùÕ¼µÄÄÚ´æÇøÓò£º
¡¡¡¡//main.cpp
¡¡¡¡int a = 0; È«¾Ö³õʼ»¯Çø
¡¡¡¡char *p1; È«¾Öδ³õʼ»¯Çø
¡¡¡¡main()
¡¡¡¡{
¡¡¡¡int b; //Õ»ÖÐ
¡¡¡¡char s[] = "abc"; //Õ»ÖÐ
¡¡¡¡char *p2; //Õ»ÖÐ
¡¡¡¡char *p3 = "123456"; //123456\0ÔÚ³£Á¿Çø£¬p3ÔÚÕ»ÉÏ
¡¡¡¡static int c =0£» //È«¾Ö£¨¾²Ì¬£©³õʼ»¯Çø
¡¡¡¡//ÒÔÏ·ÖÅäµÃµ½µÄ10ºÍ20×Ö½ÚµÄÇøÓò¾ÍÔÚ¶ÑÇø
¡¡¡¡p1 = (char *)malloc(10);
¡¡¡¡p2 = new char[20];//(char *)malloc(20);
¡¡¡¡strcpy(p1, "123456"); //123456\0·ÅÔÚ³£Á¿Çø£¬±àÒëÆ÷¿ÉÄܻὫËüÓëp3ËùÖ¸ÏòµÄ"123456"ÓÅ»¯³ÉÒ»¸öµØ·½¡£
¡¡¡¡}
¡¡¡¡¶þ¡¢Õ»£¨stack£©ºÍ¶Ñ£¨heap£©¾ßÌåµÄÇø±ð¡£
¡¡¡¡1¡¢ÔÚÉêÇ뷽ʽÉÏ
¡¡¡¡Õ»£¨stack£©: ÏÖÔںܶàÈ˶¼³Æ֮Ϊ¶ÑÕ»£¬Õâ¸öʱºòʵ¼ÊÉÏ»¹ÊÇÖ¸µÄÕ»¡£ËüÓɱàÒëÆ÷×Ô¶¯¹ÜÀí£¬ÎÞÐèÎÒÃÇÊÖ¹¤¿ØÖÆ¡£ ÀýÈ磬ÉùÃ÷º¯ÊýÖеÄÒ»¸ö¾Ö²¿±äÁ¿ int b ϵͳ×Ô¶¯ÔÚÕ»ÖÐΪb¿ª±Ù¿Õ¼ä£»ÔÚµ÷ÓÃÒ»¸öº¯Êýʱ£¬ÏµÍ³×Ô¶¯µÄ¸øº¯ÊýµÄÐβαäÁ¿ÔÚÕ»Öпª±Ù¿Õ¼ä¡£
¡¡¡¡¶Ñ£¨heap£©: ÉêÇëºÍÊÍ·ÅÓɳÌÐòÔ±¿ØÖÆ£¬²¢Ö¸Ã÷´óС¡£ÈÝÒײúÉúmemory leak¡£
¡¡¡¡ÔÚCÖÐʹÓÃmallocº¯Êý¡£
¡¡¡


Ïà¹ØÎĵµ£º

ÅжÏC?ÐÐ??¾³µÄ³ÌÐò

/*
**ÅжÏC?ÐÐ??¾³µÄ³ÌÐò
*/
/*
**¾²?³õʼ»¯
*/
int static_variable=5;
void
f()
{
 register int i1, i2, i3, i4, i5, i6, i7, i8, i9, i10;
 register char *c1, *c2, *c3, *c4, *c5, *c6, *c7 , *c8, *c9, *c10;
 extern int a_very_long_name_to_sec_how_long_they_can_be;
 double ......

Ubuntu linuxϵͳÏ°²×°C kermit´®¿Ú¹¤¾ß

½â¾ö²½Ö裺
gylu@dell-desktop:~$ sudo apt-get install ckermit
ÏÔʾ°²×°¹ý³Ì
gylu@dell-desktop:~$gedit ~/.kermrc
ÊäÈëÏÂÃæÄÚÈݺ󱣴æ.kermrcÍ˳ö:
   set line            /dev/ttyS0
    set speed    & ......

cºÍjavaÖеĶþ½øÖÆÎļþ


×î½üÐèҪдһ¶Î³ÌÐò£¬Íê³ÉÒÔÏµĹ¤×÷£¬ÓÃjava½«Êý¾ÝÒÔ¶þ½øÖƵÄÐÎʽдÈëÎļþÖУ¬È»ºóÓÃC¶Á³ö´Ë¶þ½øÖÆÎļþ¡£
¿ªÊ¼µÄʱºòûÓп¼ÂÇ»úÆ÷µÄ×Ö½ÚÐò£¬Ö±½Ó¸ã³ösegment fault.ÏëÁ˺ܾ㬲ÅÃ÷°×Ô­À´ÊÇjavaºÍCµÄ×Ö½ÚÐòÊDz»Ò»ÑùµÄ¡£
javaÖеÄ×Ö½ÚÐòÊÇbig endianµÄ£¬ËüÊÇÓë»úÆ÷Î޹صġ£¶øcµÄ×Ö»úÐòÊÇ»úÆ÷Ïà¹ØµÄ£¬¶øµ±Ç°ÓõĻúÆ÷ÊÇx84 ......

Beautify your c/c++ source code

http://uncrustify.sourceforge.net/
Ident code, aligning on parens, assignments, etc
Align on '=' and variable definitions
Align structure initializers
Align #define stuff
Align backslash-newline stuff
Reformat comments (a little bit)
Fix inter-character spacing
Add or remove parens on return ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ