C/C++Ö¸Õë
ºÎΪָÕë £¿
¡¡¡¡Ö¸Õë»ù±¾ÉϺÍÆäËüµÄ±äÁ¿Ò»Ñù£¬Î¨Ò»µÄÒ»µã²»Í¬¾ÍÊÇÖ¸Õë²¢²»°üº¬Êµ¼ÊµÄÊý¾Ý£¬¶øÊÇ°üº¬ÁËÒ»¸öÖ¸ÏòÄÚ´æλÖõĵØÖ·£¬Äã¿ÉÒÔÔÚÕâ¸öµØÖ·ÕÒµ½Ä³Ð©ÐÅÏ¢¡£ÕâÊÇÒ»¸öºÜÖØÒªµÄ¸ÅÄ²¢ÇÒÐí¶à³ÌÐò»òÕß˼Ï붼Êǽ«Ö¸Õë×÷ΪËüÃǵÄÉè¼Æ»ù´¡£¬ÀýÈçÁ´±í¡£
¿ªÊ¼
¡¡¡¡ÈçºÎ¶¨ÒåÒ»¸öÖ¸Õ룿ßÀ£¬¾ÍÏñ¶¨ÒåÆäËüµÄ±äÁ¿Ò»Ñù£¬²»¹ýÄ㻹ÐèÒªÔÚ±äÁ¿Ãû֮ǰÌí¼ÓÒ»¸öÐǺš£ÀýÈ磬ÏÂÃæµÄ´úÂë´´½¨ÁËÁ½¸öÖ¸ÏòÕûÊýµÄÖ¸Õ룺
int* pNumberOne;
int* pNumberTwo;
¡¡¡¡×¢Òâµ½±äÁ¿ÃûµÄǰ׺“p”ÁËÂð£¿ÕâÊDZàд´úÂëµÄÒ»¸öÏ°¹ß£¬ÓÃÀ´±íʾÕâ¸ö±äÁ¿ÊÇÒ»¸öÖ¸Õë¡£
¡¡¡¡ÏÖÔÚ£¬ÈÃÎÒÃÇ°ÑÕâЩָÕëÖ¸ÏòһЩʵ¼ÊµÄÖµ°É£º
pNumberOne = &some_number;
pNumberTwo = &some_other_number;
¡¡¡¡“&”±êÖ¾Ó¦¸Ã¶Á×÷“the address of£¨……µÄµØÖ·£©”£¬ËüµÄ×÷ÓÃÊÇ·µ»ØÒ»¸ö±äÁ¿µÄÄÚ´æµØÖ·£¬¶ø²»ÊÇÕâ¸ö±äÁ¿±¾Éí¡£ÄÇôÔÚÕâ¸öÀý×ÓÖУ¬pNumberOne¾ÍÊÇsome_numberµÄµØÖ·£¬Òà³Æ×÷pNumberOneÖ¸Ïòsome_number¡£
¡¡¡¡ÏÖÔÚ£¬Èç¹ûÎÒÃÇÏëʹÓÃsome_numberµÄµØÖ·µÄ»°£¬ÄÇôÎÒÃǾͿÉÒÔʹÓÃpNumberOneÁË¡£Èç¹ûÎÒÃÇÏ£Íû¾ÓÉpNumberOne¶øʹÓÃsome_numberµÄÖµµÄ»°£¬ÎÒÃÇ¿ÉÒÔÓÃ*pNumberOne¡£“*”Ó¦¸Ã¶Á×÷“the memory location pointed to by£¨ÓÉ……Ö¸ÏòµÄÄÚ´æλÖã©”£¬ËüÓÃÀ´È¡µÃÖ¸ÕëËùÖ¸ÏòµÄÖµ¡£²»¹ýÖ¸ÕëÉùÃ÷µÄÇé¿öÀýÍ⣬Èç“int *pNumber”¡£
µ½ÏÖÔÚ¶¼Ñ§µ½Ê²Ã´ÁË£¨Ò»¸öÀý×Ó£©£º
¡¡¡¡ßÝ£¡ÒªÀí½âµÄ¶«Î÷Ì«¶àÁË£¬ËùÒÔÔÚ´ËÎÒ½¨Ò飬Èç¹ûÄ㻹ÊDz»Àí½âÒÔÉϵĸÅÄîµÄ»°£¬ÄÇô×îºÃÔÙͨ¶ÁÒ»±é£»Ö¸ÕëÊÇÒ»¸ö¸´ÔÓµÄÖ÷Ì⣬ҪÕÆÎÕËüÊÇÒª»¨Ð©Ê±¼äµÄ¡£
¡¡¡¡ÕâÀïÓÐÒ»¸öʾÀý£¬½â˵ÁËÉÏÃæÌÖÂÛµÄÄÇЩ¸ÅÄî¡£ËüÊÇÓÉC±àд³É£¬²¢²»´øÓÐC++µÄÄÇЩÀ©Õ¹¡£
#include <stdio.h>
void main()
{
// ÉùÃ÷±äÁ¿£º
int nNumber;
int *pPointer;
// ÏÖÔÚ£¬¸øËüÃǸ³Öµ£º
nNumber = 15;
pPointer = &nNumber;
// ´òÓ¡nNumberµÄÖµ£º
printf("nNumber is equal to : %d\n", nNumber);
// ÏÖÔÚ£¬Í¨¹ýpPointerÀ´¿ØÖÆnNumber£º
*pPointer = 25;
// Ö¤Ã÷¾¹ýÉÏÃæµÄ´úÂëÖ®ºó£¬nNumberµÄÖµÒѾ¸Ä±äÁË£º
printf("nNumber is equal to : %d\n", nNumber);
}
¡¡¡¡Çëͨ¶Á²¢±àÒëÒÔÉÏ´úÂ룬²¢È·ÐÅÄãÒѾŪ¶®ÁËËüÊÇÈçºÎ¹¤×÷µÄ¡£È»ºó£¬µ±Äã×¼±
Ïà¹ØÎĵµ£º
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, ......
ÔÚnetbeansÖбà¼C/C++ÊÇÒ»ÖÖ²»´íµÄÑ¡Ôñ£¬ÏÂÃæÎÒ¾Í˵һÏÂÕû¸öÁ÷³ÌµÄÅäÖÃ
1.ÏÈÏÂÔØMinGW
ÕâÊDZàÒëc/c++µÄ±àÒëÆ÷£¬ÔÚwindowsÏÂÖ±½ÓÒÔ.exeµÄ·½Ê½ÔËÐУ¬ÏÂÒ»²½µÄ²Ù×÷£¬Ò»Ö±µ½°²×°Íê³É¡£
2.ÏÂÔØmsys
ÕâÊǺÍMinGWͬ²½Ê¹ÓÃ
3.ÅäÖû·¾³
ÔÚÎҵĵçÄÔ->ÊôÐÔ->¸ß¼¶->»·¾³±äÁ¿ÖÐÉèÖÃMinGWºÍmsysĿ¼ÖÐbinËùÔڵķ¾¶
4.²âÊÔ
ÓÃÃüÁîÐз½Ê½Ê ......
CPU : ARM9 s3c2410
LCD : ¹æ¸ñ²»Ã÷£¨Õâ¸öºÜÎÞÄΣ¬µ«ÊÇÎÒËùÖªµÀµÄÖ»ÓÐÒ»¸ö·Ö±æÂÊ£©
Ô´ÂëÐ޸ģº
/linux-2.6.30.4/arch/arm/mach-s3c2410/mach-smdk2410.c
ÔÚÕâ¸öÎļþÖмÓÈëframebufferµÄ³õʼ»¯Êý¾Ý½á¹¹£¨¾ßÌåÊý¾Ý²ÎÕÕLCD¼¼ÊõÊֲᣩÈçÏ£º
#include <mach/fb.h> ......
ÔÎĵØÖ·£ºhttp://www.layz.net/blog/user1/xuanxuan/archives/2006/67.html
ÔÚC++ÖУ¬ÓÐÒ»¸östreamÕâ¸öÀ࣬ËùÓеÄI/O¶¼ÒÔÕâ¸ö“Á÷”ÀàΪ»ù´¡µÄ£¬°üÀ¨ÎÒÃÇÒªÈÏʶµÄÎļþI/O£¬streamÕâ¸öÀàÓÐÁ½¸öÖØÒªµÄÔËËã·û£º
1¡¢²åÈëÆ÷(<<)
¡¡¡¡ÏòÁ÷Êä³öÊý¾Ý¡£±ÈÈç˵ϵͳÓÐÒ»¸öĬÈϵıê×¼Êä³öÁ÷(cout)£ ......
¶ÔÓÚC±àд³ÌÐò£¬´ó²¿·Ö¶¼¿ÉÒÔͨ¹ý£¬µ«ÊDz»»áÍêÈ«¼æÈÝ£¬¾ÙÁ½¸öÀý×Ó£º
1.
char *str;
str = malloc(32);
2.
char ch[3] = "abc";
gcc -g -o test test.c
g++ -g -o test test.c
ÒòΪC++¼ì²é¸ü¼ÓÑϸñ£¬CûÓÐÕâôÑϸñ¡£
´ó¼Ò¿ÉÒԱȽÏһϣ¬gcc²»»á±¨´í£¬g++»á±¨´í¡£
Èç¹û´ó¼Ò»¹ÓÐеÄcase,»¶Ó ......