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

C/C++ÓïÑÔʵÏÖ¶¯Ì¬Êý×é


CÊý×éµÄСÎÊÌâ
     ÕâÀï˵µÄ¶¯Ì¬Êý×éÊÇ¿ÉÒÔ¸ù¾ÝÐèÒª¶¯Ì¬Ôö³¤Õ¼ÓÃÄÚ´æµÄÊý×飬±ÈÈç³ÌÐò³õʼ·ÖÅäÁË100¸öÔªËØ£¬¿ÉÊÇÔËÐÐÁËÒ»¶Îʱ¼äºóÇøÇø100¸ö¿Õ¼ä²»ÄÜÂú×ãÁË£¬ÏÖÔÚÐèÒª400¸ö£¬Ôõô°ìÄØ£»Äǿ϶¨ÐèÒªÔÙ¶îÍâ·ÖÅä300¸ö¡£
     CÓïÑÔÓÐrealloc()º¯ÊýÀ´½â¾ö¿Õ¼äÀ©³äµÄÎÊÌ⣬µ«ÊDz»ÒªÍüÁËrealloc¿ÉÄÜ»áǨÒÆÄڴ棬ºÜ¶àʱºòÊý×éÖеÄÔªËػᱻÆäËüº¯Êý/Ä£¿éÒýÓã¬Èç¹ûµØÖ··¢ÉúÁ˱仯£¬½á¹û½«ÊÇÔÖÄÑÐԵġ£
     ÄÇôSTLµÄvectorÄØ£¿ËüÒ²ÓÐÏàͬµÄÎÊÌâ¡£
     Ò»´Î·ÖÅä×ã¹»µÄ¿Õ¼äÊÇ¿ÉÒÔ½â¾öÕâ¸öÎÊÌ⣬ºÜÃ÷ÏÔÕâ»áÔì³ÉÄÚ´æµÄÀË·Ñ£¬Õâ¸ö×ö·¨²»ËãÃ÷ÖÇ¡£
     ²»Ê¹ÓÃÊý×éÄØ£¿Ê¹ÓÃlistÄܽâ¾öÒ»²¿·ÖÎÊÌ⣬µ«ÊÇlist²»ÄÜÖ§³ÖËæ»ú·ÃÎÊ°¡£¬¼øÓÚЧÂÊÉϵÄÓ²ÉË£¬ÏÔÈ»²»ÄÜËæ±ãÓÃlistÌæ»»Êý×é¡£
     Ôõô½â¾öÕâ¸öÎÊÌâÄØ£¿¶¯Ì¬Êý×飡ÔÚHPServer µÄDemutex Table¾ÍÓõ½Á˶¯Ì¬Êý×飬ÊÂʵ֤Ã÷Ч¹û²»´í¡£
¶¯Ì¬Êý×éµÄÌØÕ÷
¶¯Ì¬Êý×éÊÇÒ»¸öºÜ¼òµ¥Ò×ÓõÄÊý¾Ý½á¹¹£¬µ«ÊǼòµ¥²»´ú±íÓŵãС£¬ËüµÄÌØÕ÷ÈçÏ£º
1 ¸ù¾ÝÐèÒª¶¯Ì¬ÅúÁ¿Ôö³¤Äڴ棻
2 Ò»¾­·ÖÅ䣬ԪËصØÖ·²»»áÔٴα仯£»
3 ʵÏÖ¼òµ¥£¬Ð§Âʸߣ¬ÊÂʵÉÏËüºÍÆÕͨÊý×éÏà±È»ù±¾Ã»ÓÐЧÂÊËðʧ£»
4 ×î´ó¸öÊý¹Ì¶¨£» 
Æäʵ×îÖØÒªµÄ¾ÍÊÇÌØÕ÷2ÁË£¬²»È»Ö±½ÓʹÓÃrealloc¶à·½±ãÄØ£¬µ±È»¶¯Ì¬Êý×éµÄʵÏÖÒ²ºÜ·½±ã£¬ÏÂÃæ¾Í»áÏêϸ˵˵¡£
ÌØÕ÷4ʵ¼ÊÉÏÊǸöÏÞÖÆ£¬µ«ÊÇÏàÐÅÎÒ£¬ÄãµÄ³ÌÐò²»¿ÉÄÜ´ïµ½Õâ¸ö×î´óÖµ¡£
¶¯Ì¬Êý×éµÄʵÏÖ
ÈçÉÏÃæËù˵µÄ£¬¶¯Ì¬Êý×éʵÏÖÆðÀ´ºÜ¼òµ¥£¬ÒÔ϶¼¼ÙÉèÊý×éÔªËØÀàÐÍÊÇT£¬Ê×ÏÈÐèÒªÒ»¸ö¸¨ÖúÊý¾Ý½á¹¹¡£
view plaincopy to clipboardprint?
struct ARRAY_ELE_S  
{  
    T item_array[1024];  
};  
ARRAY_ELE_S *pArray[2000];  
int iSize;   
±äÁ¿pArrayÊÇÒ»¸öARRAY_ELE_SÀàÐ͵ÄÖ¸ÕëÊý×飬Õâ¸öÒ²¾ÍÊÇÄãµÄ¶¯Ì¬Êý×éÁË£»iSize¼Ç¼Á˵±Ç°Êý×éµÄ´óС¡£
ÉÏÃæµÄ´úÂë±íÃ÷£º
1 Êý×éÿ´Î¶¯Ì¬Ôö³¤1024¸öÔªËØ£»
2 Êý×éµÄ×î´óÔªËظöÊý¿ÉÒÔµ½£º2000*1024¸ö£¬Èç¹ûÕâ¸ö»¹²»¹»£¬Äã¿ÉÒÔ°ÑÕâ¸öÖµ¸ÄµÄ¸ü´óµã¡£
ÏÈÀ´¿´¿´ÄÚ´æÕ¼Óã¬pArray±¾ÉíÕ¼ÓÃ2000*4£¬´óÔ¼ÊÇ8KµÄÄڴ棬»ù±¾¿ÉÒÔºöÂÔÁË¡£
Èç¹ûÒ»´Î·ÖÅäÒ»¸ö2000*1024µÄÊý×éarray[2000*1024]£¬ÄÇôһ´Î¾ÍÒª·ÖÅäµÄÄÚ´æÊÇ£º2*sizeof


Ïà¹ØÎĵµ£º

תÔØ:Hadoop Ó¦¸ÃÓÃC++ʵÏÖ£¬¶ø²»ÊÇJava

http://www.trendcaller.com/2009/05/hadoop-should-target-cllvm-not-java.html
Sunday, May 10, 2009
Hadoop should target C++/LLVM, not Java (because of watts)
< type="text/javascript">
digg_url="http://www.trendcaller.com/2009/05/hadoop-should-target-cllvm-not-java.html";
Over the years, ......

C ÖÐ extern ºÍ static

CÓïÑÔÖУº
extern £ºextern£¨ÍⲿÒýÓã©¿ÉÒÔÖÃÓÚ±äÁ¿»òÕߺ¯ÊýÇ°£¬ÒÔ±êʾ±äÁ¿»òº¯ÊýµÄ¶¨ÒåÔÚ±ðµÄÎļþÖУ¬ÔÚÒ»¸öÎļþÖÐÓõ½µÄexternÕâЩ±äÁ¿»òº¯ÊýÊÇÍâÀ´µÄ£¬²»ÊDZ¾Îļþ¶¨ÒåµÄ£¬Ìáʾ±àÒëÆ÷Óöµ½´Ë±äÁ¿ºÍº¯ÊýʱÔÚÆäËûÄ£¿éÖÐÑ°ÕÒÆ䶨Òå¡£×¢Ò⣬ֻÓÐÆäËûÎļþÖеÄÈ«¾Ö±äÁ¿²ÅÄܱ»ÆäËûÎļþËùextern¡£
extern int val;
×¢£º
  ......

[ת]ubuntuÏÂc£¯c++¿ª·¢»·¾³ÅäÖÃ

ubuntuϵÄc/c++»·¾³´î½¨ÊDZȽϼòµ¥,ÒòΪÓÐaptºÍÐÂÁ¢µÃµÄ°ïÖú.
1.
Ê×ÏÈÊÇÅäÖÃgcc,ÔÚubuntu°²×°Íê³ÉÒѾ­ÓÐgccÁË(gccÊÇÓÉGNUÖ®¸¸StallmanËù¿ª·¢µÄlinuxϵıàÒëÆ÷£¬È«³ÆΪGNU
Compiler Collection£¬ Ä¿Ç°¿ÉÒÔ±àÒëµÄÓïÑÔ°üÀ¨£ºC, C++, Objective-C, Fortran, Java,
and
Ada.).µ«ÊÇgcc»¹²»ÄܱàÒëÎļþ.ÒòΪȱÉÙһЩͷÎļþ.Ä ......

javaÓëc++Óï·¨Çø±ð

//1.JavaÖÐ×Ö·û´®²»ÄܶàÐÐÊéд¡£¶àÐÐÊéдÓÃÒýºÅ¸ô¶Ï£¬¼ÓºÅÏàÁ¬¡£  
  //2.JavaµÄ±êʶ·û¿ÉÒÔÓÃÃÀÔª·ûºÅ¿ªÍ·¡£  
  //3.JavaÖÐûÓÐÎÞ·ûºÅ±äÁ¿»òÎÞ·ûºÅ³£Á¿µÄ¸ÅÄî¡£ËùÓеıäÁ¿¶¼ÊÇÓзûºÅµÄ¡£  
  //4.JavaÖбäÁ¿µÄ×Ö³¤Êǹ̶¨µÄ¡£²»´æÔÚcharºÍwcharÖ®·Ö¡£  
  //5.JavaÖбäÁ¿Î ......

C Cpp IDE

from£ºhttp://wiki.ubuntu.org.cn/index.php?title=C_Cpp_IDE&variant=zh-cn
¼øÓÚ²»¶ÏÓÐÍøÓѽ«±àÒëÆ÷ GCC ÎóÈÏΪ IDE£¨¼¯³É¿ª·¢»·¾³£©
ÆÚÍûÍÑÀëÃüÁîÐÐ
ÆÚÍûÄÜÔڲ˵¥Öз¢ÏÖÆäÉíÓ°
ÆÚÍûÆäÄÜÓÐÒ»¸ö¼¯±à¼­±àÒëÁ´½Óµ÷ÊÔÔËÐÐÓÚÒ»ÌåµÄ½çÃæ
¹Ê±¾Îĸø´ó¼Ò¼òµ¥ÂÞÁÐһЩ C/C++ ±à³ÌÖпÉÓÃµÄ IDE£¬»òÐíÄã´ÓÖпÉÒÔÕÒÒ»¸öÄãϲ»¶µ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ