C/C++³ÌÐòÔ±±Ø¶ÁµÄÊ®±¾Êé
ÔÚGmail TopLanguage Group Öп´µ½Ò»ÆªÎÄÕ“C/C++³ÌÐòÔ±±Ø¶ÁµÄÊ®±¾Ê飨ÉÏ£©”£¬´ó¼ÒµÄÌÖÂÛ¶¼ºÜ¼¤Àø£¬´ó¼Ò¶¼¾õµÃÕâƪÎÄÕÂдµÃºÜ°ô£¬ÎÒÏëÔÚGroupÀïµÄÅóÓѶ¼ÄÜÔÚLookgirlµÄÕâƪÎÄÕÂÀï»ñÒæ²»ÉÙ£¬Îª´Ë¶·µ¨ÔÚ´ËתÔظÃÎÄ£¬¹©¸ü¶àÅóÓѽ»Á÷¡¢Ñ§Ï°¡£
C/C++³ÌÐòÔ±±Ø¶ÁµÄÊ®±¾Ê飨ÉÏ£©
Õâ¸öÌâÄ¿´óµÄÓÐЩÀëÆ×£¬Êµ»°Ëµ£¬Ö»ÊÇÏëÍƼöÒ»ÏÂ×Ô¼º¾õµÃºÜºÃ¡¢ÖµµÃÊղصÄһЩ¼¼Êõ·½ÃæµÄͼÊé¡£Èç¹û²»ÊdzÌÐòÔ±£¬»òÕß¹ØÐĵķ½ÏòÊÇÍøÒ³¿ª·¢¡¢Êý¾Ý¿â¿ª·¢£¬»òÕßÖ»ÊÇÏëÁ˽âһϿª·¢Á÷³Ì£¬ÕâЩÊé²»¶¼ÊÇÊʺÏÄ㣬µ«Ò²ºÜÖµµÃÊÕ²ØÁË¡£
ÕâƪÎÄ×ÖµÄÕë¶ÔÄ¿±êÊÇ£¬Î¢Èíƽ̨ϵÄc/c++³ÌÐòÔ±£¬Ñ§¹ý¼ÆËã»ú»ù´¡Ñ§¿Æ£¬ÓÐÒ»¶¨µÄÓ¢ÓïÔĶÁÄÜÁ¦¡£½¨Ò鹺ÂòµÄ˳ÐòÒ²ÊÇ´ÓÉÏÖÁÏ¡£
£¨1£©½¨Òé´ó¼ÒÔĶÁµÄµÚÒ»±¾ÊéÊÇ¡¶±àÂëµÄ°ÂÃØ¡·£¨Ó¢ÎÄÃû¡¶code¡·£©£¨±¾ÊéÓÉ»úе¹¤Òµ³ö°æÉ绪Õ¹«Ë¾³ö°æ£©£¬Õâ±¾ÊéÖÐÎÄ°æÓ¦¸ÃÒѾ¾ø°æÁË£¬µ«ºÃÏñÓÐÓ¢ÎÄÓ°Ó¡°æ¡£Õâ±¾ÊéûÓн²¸ÃÈçºÎ±à³Ì£¬ÈçºÎдһ¸öhello world¡£ËüÉîÈëdz³öµÄ½éÉÜÁ˼ÆËã»úÊÇÈçºÎ×é³ÉµÄ£¬±ÈÈç¶þ½øÖÆ£¬±ÈÈçÂß¼Ãŵç·µÄʵÏÖ£¬¶¼ÊǺÜdzÏԵġ£¿´ÁËÕâ±¾Ê飬»á¶Ô¼ÆËã»úÓиöÖªÆäËùÒÔÈ»µÄÁ˽⣬Ҳ¾ÍÊÇ»úÆ÷ÈçºÎʵÏÖµÄÒ»¼ÓÒ»µÈÓÚ¶þ£¬ÈçºÎÄÜÖ´ÐгÌÐò¡£¡¶±àÂëµÄ°ÂÃØ¡·ÊǼÆËã»úרҵ»òÕßÊdzõÖиßÖжԼÆËã»ú¸ÐÐËȤѧÉú£¬Ó¦¸ÃÒ»ÉÏѧ¾Í¶ÁµÄÒ»±¾Êé¡£
£¨2£©µÚ¶þ±¾Ò²Êǽ¨Òé´ó¼Ò¿´µ½ÁËÁ¢¿ÌÂòÏÂÀ´£¬±£Ö¤ÎïÓÐËùÖµ£¬¾ÍÊÇ¡¶³ÌÐòÉè¼Æʵ¼ù¡·£¨Ó¢ÎÄÃûThe Practice of Programming£©£¨±¾ÊéÓÉ»úе¹¤Òµ³ö°æÉ绪Õ¹«Ë¾³ö°æ£©¡£ÓÐÁËÕâ±¾Ê飬»ù±¾ÉÏ¡¶´úÂë´óÈ«¡·¡¢¡¶³ÌÐòÔ±ÐÞÁ¶Ö®µÀ¡·Õ⼸±¾ºóÃæÍƼöµÄÊé¿ÉÒÔ²»ÂòÁË£¬ÒòΪ¾«»ª»ù±¾É϶¼Å¨Ëõµ½Õâ±¾ÊéÀïÃ棬µ±È»£¬²»Í¬µÄ×÷Õßд³öÀ´µÄ»¹ÊDz»Ò»Ñù£¬Èç¹ûÓÐÇ®£¬»¹ÊǶ¼ÂòÁË×îºÃ¡£¡¶³ÌÐòÉè¼Æʵ¼ù¡·µÄÁ½Î»×÷ÕßBrian W.Kernigham / Rob Pike£¬ÔÚ¼ÆËã»úÁìÓò£¬¾ÍÊÇ´óʦ¼¶µÄÈËÎ¸ßɽÑöÖ¹£¬Ð´³öÈç´ËͨË×Ò׶®µÄ¼ÆËã»ú¹¤³Ìʵ¼ùÊ飬ÈÃÎÒ»¹ÄÜ˵ʲôÑöĽµÄ»°°¡¡£Äã²»ÖªµÀËûÃÇÊÇË£¿È¥ËÑwiki °É¡£ÀïÃæÿһÕ½ڶ¼·Ç³£¾µä£¬ÉõÖÁÿÕºóÃæÍƼöÑÓÉìÔĶÁµÄÊé¼®£¬¶¼ÊǾµäÖеľµä¡£Ò»¶¨ÒªÂýÂý¶Á·´¸´¶Á£¬Èç¹ûÕâ±¾Êé¿´ÍêÁËÒԺ󣬻ù±¾ÉϾÍÊÇÒ»¸ö¼ÆËã»úÖ춱à³ÌˮƽÁË¡£
£¨3£©µÚÈý±¾Êé±È½ÏÄÑÑ¡ÔñһЩ£¬»¹ÊÇÍƼöÕâ±¾ºÃÁË¡¶C³ÌÐòÉè¼ÆÓïÑÔ£¬µÚ2°æ¡·£¬Ò²¾ÍÊÇ´«ËµÖеÄK&R£¬Èç¹ûÄãÊÇÒ»¸ö¼ÆËã»úרҵµÄѧÉú£¬»¹Ã»ÓÐÕâ±¾Ê飬ÄÇÄãÔÚѧУÀïѧÁËʲô¾ÍºÜÖµµÃ»³ÒÉ¡£Õâ±¾Êé272Ò³£¬Ã¿Ò³¶¼ºÜ¾µä£¬»ù±¾ÉÏÄãÅöµ½µÄËùÓÐcÓïÑÔÎÊÌâÔÚÕâ±¾±¡±¡µÄСÊéÀﶼÓÐÉæ¼°£¬µ«ÊÇÏÞÓÚƪ·ù£¬Ó
Ïà¹ØÎĵµ£º
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, ......
1.
printf("%.9lf\n",sum);
//Êä³öСÊýµãºó9λ²»Ê¡È¥Ä©Î²¶àÓàµÄ0
2.
printf("%.10g\n",sum);
//Êä³öСÊýµãºó9λ²»Ê¡È¥Ä©Î²¶àÓàµÄ0
3.
#include<iomanip>
cout<<setprecision(10)<<sum<<endl;
//Êä³öСÊýµãºó9λʡȥĩβ¶àÓàµÄ0
4.
#include<iomanip>
cout.pre ......
Õ»Ö÷ÒªÓÃÀ´´æ·Å¾Ö²¿±äÁ¿, ´«µÝ²ÎÊý, ´æ·Åº¯ÊýµÄ·µ»ØµØÖ·.esp ʼÖÕÖ¸ÏòÕ»¶¥, Õ»ÖеÄÊý¾ÝÔ½¶à, espµÄֵԽС.
¶ÑÓÃÓÚ´æ·Å¶¯Ì¬·ÖÅäµÄ¶ÔÏó, µ±ÄãʹÓà malloc , new µÈ½øÐзÖÅäʱ,ËùµÃµ½µÄ¿Õ¼ä¾ÍÔÚ¶ÑÖÐ. ¶¯Ì¬·ÖÅäµÃµ½µÄÄڴ渽´øÓзÖÅäÐÅÏ¢, ËùÒÔÄãÄܹ» realloc ºÍ freeµ÷ËüÃÇ.
È«¾Ö£¬¾²Ì¬ºÍ³£Á¿ÊÇ·ÖÅäÔÚÊý¾ÝÇøÖеġ£Êý¾ÝÇø°üÀ¨b ......
Ò»¸öºÜ¼ò½àµÄËã·¨£º
void Reverse(char s[])
{
for(int i = 0, j = strlen(s) - 1; i < j; ++i, --j) {
char c = s[i];
s[i] = s[j];
s[j] = c;
& ......