C/C++µ¥Ôª²âÊÔÀíÂÛ¾«Òª£¨Î壩
µÚ¶þÕ Õ÷·þ¿É²âÐÔÄÑÌâ
2.1 ¿É²âÐÔÎÊÌâÏê½â£¨1£©
µ¥Ôª²âÊÔЧÒæÌرð¸ß£¬·½·¨Ò²ºÜ¼òµ¥£¬µ«È´³¢ÊÔµÄÆóÒµºÜ¶à£¬³É¹¦ÊµÊ©µÄÆóÒµºÜÉÙ£¬ÎªÊ²Ã´ÄØ£¿Ö÷ÒªÔÒò¾ÍÊÇÄÑÓÚÍ»ÆƿɲâÐÔÎÊÌâ¡£“¿É²â”Õâ¸ö´Ê£¬Òâ˼ÒѾºÜÃ÷°×ÁË£¬Èç¹û²»“¿É²â”µÄ»°£¬ÄǾÍÊDz»Äܲ⣬û·¨²â£¬¾ÍÊÇ×ö²»ÏÂÈ¥£¬»òÕßÀ§ÄÑÌ«¶à£¬³É±¾Ì«ÖØ£¬ÈÈÇé±»Öð½¥ÏûÄ¥£¬×îºó×ö²»ÏÂÈ¥¡£ËùÒԿɲâÐÔÎÊÌâÊǵ¥Ôª²âÊԵĹؼü£¬ÊÇÎÒÃÇÊ×ÏÈÒª½â¾öµÄ¡£
¿É²âÐÔÎÊÌâÊÇÖ¸´úÂëµÄ¿É²âÐԺܲµ¼Ö²âÊÔºÜÀ§ÄÑ£¬ÕâÊǵ¥Ôª²âÊԵĹؼü×è°¡£ÎªÊ²Ã´´úÂëµÄ¿É²âÐÔ»áºÜ²îÄØ£¿ÔÒòÊÇʲô£¿Ò»°ãÀ´Ëµ£¬ÕâЩÔÒòµ¼ÖÂÁË´úÂëµÄ¿É²âÐԲÏîÄ¿ºÜ¸´ÔÓ£¬¿ª·¢Á÷³Ì²»¹æ·¶£¬ñîºÏ¶ÈºÜ¸ß¡£ñîºÏÊÇÖ¸´úÂëÖ®¼äµÄ»¥ÏàÒÀÀµ£¬ÀýÈçÒ»¸öº¯Êýµ÷ÓÃÁíÒ»¸öº¯Êý£¬¾ÍÊÇñîºÏ¡£
Ò»°ãµÄ½¨ÒéÊǸĽø¿ª·¢Á÷³Ì£¬Ìá¸ß´úÂë¿É²âÐÔ¡£µ«´Óʵ¼ùÀ´¿´£¬ÕâÊDz»ÏÖʵµÄ¡£¿É²âÐÔ²îÔÚÆóÒµÏîÄ¿ÖÐÆÕ±é´æÔÚ£¬ÓÐÆä¿Í¹ÛÔÒò£¬ºÜÄѸı䡣Ê×ÏÈ£¬ÆóÒµÏîÄ¿±¾Éí¾Í¶àÊǺܸ´Ôӵģ¬ÕâÊÇÐèÇó¾ö¶¨µÄ£¬¸Ä²»ÁË¡£Æä´Î£¬³ÌÐò²¢²»ÊÇÐéÎ޵ģ¬³ÌÐòÊǿ͹ÛÊÂÎïµÄ·´Ó³£¬¿Í¹ÛÊÂÎï±¾ÉíÊÇ»¥Ïà¹ØÁª£¬»¥Ïà¾À²øµÄ£¬±ØÈ»ÐγɴúÂë¼äµÄñîºÏ¡£µÚÈý£¬Á÷³Ì¸Ä½øÊÇÒ»¸ö³¤Æڵġ¢½¥½ø¡¢À§ÄѵĹý³Ì£¬²»¿ÉÄܶÌÆÚÄÚʵÏÖ·ÉÔ¾£¬¸ü²»ÊÇÒý½ø¼¸¸ö¹¤¾ß»òÕ߹淶¾Í¿ÉÒÔ×öµ½µÄ¡£Õâ·½ÃæÎÒÓйý½Ìѵ£¬¼¸ÄêÇ°£¬ÎÒÒ²ÈÏΪ¿ÉÒÔͨ¹ýÁ÷³Ì¸Ä½øÀ´Ìá¸ß¿É²âÐÔ£¬Ò²¸ø¿Í»§ÍƼö¹ýÏà¹ØµÄ½â¾ö·½°¸£¬½á¹û¶¼²î²»¶à£ºÀÍÃñÉ˲ơ£ËùÒÔ£¬¿ÉÒÔ˵£¬¿É²âÐÔ²îÓÐÆä±ØÈ»ÐÔ£¬ÕâÊǿ͹ÛÏÖʵ¡£
ÄÇô£¬ÈçºÎ½â¾ö¿É²âÐÔÎÊÌâÄØ£¿Ö»ÓдӲâÊÔ¼¼ÊõµÄ½Ç¶ÈÀ´¿¼ÂÇ£¬²ÅÓпÉÄÜÕÒµ½ÕæÕýÓÐЧµÄ;¾¶¡£Òª½â¾öÎÊÌ⣬ÎÒÃÇÊ×ÏÈÒª¶ÔÎÊÌâÓгä·ÖµÄÁ˽⣬ÏÖÔÚÀ´¿´¿´¿É²âÐÔÎÊÌâ¾ßÌå°üº¬Ê²Ã´¡£
Ò»¸öº¯ÊýÒª“¿É²â”£¬Òª×öµ½Á½·½Ã棺µÚÒ»ÊÇÄܹ»¶ÀÁ¢ÔËÐУ¬µÚ¶þÊÇÒªÄܹ»¸²¸ÇÊäÈë·ÖÀࡣΪʲôҪ¸²¸ÇÊäÈë·ÖÀàÄØ£¿ÒòΪµ¥Ôª²âÊÔµÄÄ¿±êÊǸ²¸Ç´úÂëµ¥ÔªµÄ¹¦ÄÜÂß¼£¬Òª×öµ½¸²¸Ç¹¦ÄÜÂß¼£¬¾ÍÒª¸²¸ÇÊäÈëµÄËùÓзÖÀà¡£Èç¹û´úÂë¿É²âÐԲÓÖûÓа취½â¾öµÄ»°£¬ÒªÃ´Ã»·¨¶ÀÁ¢ÔËÐУ¬ÒªÃ´×ö²»µ½¸²¸ÇÊäÈë¡£ÕâÁ½µãÓÐÒ»¸ö×ö²»µ½£¬¾ÍÊDz»¿É²â£¬»òÕß´ï²»µ½Ô¤ÆÚЧ¹û¡£
ÎÒÃÇÏÈÀ´¿´¿´¶ÀÁ
Ïà¹ØÎĵµ£º
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++ÖУ¬¹ØÓÚCPPµÄÍ·Îļþ»¥Ïà°üº¬µÄÎÊÌâºÜÈÃÈËÍ·ÌÛ£¬ÆäʵÎÒÃÇËÒ²²»Ô¸ÒâŪµÄ½á¹¹»ìÂÒ£¬ÄÑÒÔÀí½â£¬µ«ÓÐʱÓÖÊÇÓбØÐëµÄ¡£
¼Ù¶¨µ±Ç°ÓÐÁ½¸öÍ·Îļþ·Ö±ðΪ A.h ºÍ B.h£¬ÄÚÈÝ·Ö±ðÈçÏ£º
A.hÄÚÈÝΪ£º
#ifndef  ......
3.ÄÚ¹¦Ìâ
¡¡¡¡ÊÔÌâ1£º·Ö±ð¸ø³öBOOL£¬int£¬float£¬Ö¸Õë±äÁ¿ Óë“ÁãÖµ”±È½ÏµÄ if Óï¾ä£¨¼ÙÉè±äÁ¿ÃûΪvar£©
¡¡¡¡½â´ð£º
¡¡¡¡¡¡BOOLÐͱäÁ¿£ºif(!var)
¡¡¡¡¡¡intÐͱäÁ¿£º if(var==0)
¡¡¡¡¡¡floatÐͱäÁ¿£º
¡¡¡¡¡¡const float EPSINON = 0.00001;
¡¡¡¡¡ ......
#include<stdio.h>
#include<math.h>
float x1,x2,disc,p,q;
int main()
{
void greater_than_zero(float,float);
void equal_to_zero(float,float);
void smaller_than_zero(float,float);
float a,b,c;
printf("\ninput a,b,c:");
scanf("%f,%f,%f",&a,&b,&c) ......