C/C++Ö¸ÕëºÍÊý×éµÄʹÓúÍÇø±ð
³£¼ûµÄÄÚ´æ·ÖÅäºÍʹÓôíÎó
1) ÄÚ´æµÄÉêÇëºÍ·ÖÅ䲢ûÓгɹ¦£¬µ«³ÌÐòԱȴʹÓÃÁËËü¡£Ò»Ð©ÐÂÊÖ¾³£»á·¸ÕâÖÖ´íÎó£¬ËûÃDz¢²»»áÁôÒâµ½ÄÚ´æûÓзÖÅä³É¹¦¡£ÅжÏÖ¸ÕëµÄÖµÊÇ·ñΪNULL¿ÉÒÔÓÐЧµØ±ÜÃâÕâÖÖ´íÎó¡£
2) ÄÚ´æµÄ·ÖÅäÒѾ³É¹¦£¬µ«ÊÇȴûÓнøÐгõʼ»¯¾ÍÖ±½ÓʹÓÃËüÁË¡£Ê×ÏÈÊǹÛÄîÉϵÄÎÊÌ⣬ºÜ¶àÈ˶¼Ã»ÓÐÔÚʹÓÃÖ¸ÕëÇ°Òª³õʼ»¯ÕâÑùµÄÏ°¹ß£¬È»¶øÕâ¸öÏ°¹ßÈ´ÊǺÜÖØÒªµÄ£¬Ï£Íû´ó¼ÒÒ»¶¨ÒªÇ¿ÆÈ×Ô¼ºÑø³É¡£µÚ¶þ¾ÍÊÇÖ÷¹ÛµØÈÏΪ×Ô¼ºÉêÇëµÄÄÚ´æµÄȱʡֵΪ0£¬ÕâÑùÏëÊÇûÓÐʲôµÀÀíµÄ£¬ÄÚ´æ·ÖÅäºóµÄÖµÊDz»È·¶¨µÄ¡£
3) ÉÏÃæµÄÁ½ÖÖ¹¤×÷¶¼ÒѾ×öºÃÁË£¨ÒѾ³É¹¦ÉêÇë²¢³õʼ»¯Íê³É£©£¬µ«ÊDzÙ×÷ʱȴԽ½çÁË¡£
4) ÉêÇëÁËÄڴ棬ʹÓÃÍêÁËÈ´Íü¼ÇÁËÊÍ·Å£¬µ¼ÖÂÄÚ´æй¶¡£ÕâÑùµÄ´íÎó¿ÉÒÔÐÎÈÝΪһ¸ö¶ñÐÔµÄÖ×Áö£¬Ëü²»»áÂíÉÏÒªÄãµÄÃü£¬µ«ÊÇËü»áÂýÂýµØÍÌÊÉÄãµÄϵͳ×ÊÔ´£¬Ö±µ½ÄãµÄ³ÌÐò³¹µ×Íêµ°¡£
5) ÄãºÜСÐĵØÊÍ·ÅÁËÄڴ棬µ«ÊÇÈ´ÓÖʹÓÃÁËËü¡£ÓÉÓÚ³ÌÐòºÜ¸´ÔÓ»òÕßµ÷ÓÃ˳Ðò³ö´í£¬ÕâÑù¿ÉÄܵ¼Ö³öÏÖÉÏÃæµÄ´íÎó¡£
Ö¸Õë---Ò»°Ñΰ´óµÄË«Èн£
ÎÒÕæµÄ·Ç³£Åå·þ·¢Ã÷Ö¸ÕëµÄÈË£¬Ëû¼òֱ̫ΰ´óÁË¡£ÄÜʹÓÃÈç´Ë¼ò½àµØ·½·¨½«¸´ÔÓµÄÄÚ´æ½á¹¹ÃèÊöµÄÈç´ËÇå³þ£¬Õâ±¾Éí¾ÍÊÇÒ»ÖÖΰ´óµÄ³É¾Í¡£µ«ÊÇ£¬Ö¸ÕëÖ®ÓÚ³ÌÐòÔ±ÈçͬÎäÆ÷Ö®ÓÚÊ¿±ø£¬ÓúÃÁË¿ÉÒÔÍþÁ¦Îޱȣ¬Óò»ºÃÔòº¦È˺¦¼º¡£
ÎÒÏÈ˵˵ָÕëºÍÊý×éµÄÇø±ð¡£Êý×éÃû¶ÔÓ¦×ÅÒ»¿éÄڴ棬ËüµÄµØÖ·¡¢ÈÝÁ¿ÔÚÆäÉúÃüÖÜÆÚÖÐÊDz»¿É±äµÄ£¬Ö»ÓÐÊý×éÄÚÈÝÊǿɱäµÄ¡£Ö¸Õë¿ÉËæʱָÏòÈκÎÀàÐ͵ÄÄڴ棬ËüµÄÌصã¾ÍÊÇ“±ä”¡£Ö¸ÕëÔ¶±ÈÊý×éÁé»î£¬µ«Ò²¸üΣÏÕ¡£
Êý×éÃûÊDz»ÄÜÖ±½Ó½øÐи³ÖµºÍ±È½ÏµÄ¡£Èç¹ûÄãÏòÒª½«Êý×éa¸³Öµ¸øÊý×éb£¬²»ÄÜÖ±½ÓÓø³ÖµÓï¾äb = a £¬ÕâÑù»áÁî±àÒëÆ÷²úÉú´íÎóµÄ¡£±ØÐëʹÓñê×¼µÄ¿âº¯ÊýstrcpyÀ´½øÐи³Öµ¡£ÏàͬµØ£¬Òª±È½ÏaºÍbµÄÄÚÈÝÊÇ·ñÏàͬ£¬²»ÄÜʹÓÃÆÕͨµÄÂß¼ÅжÏif£¨b==a£©£¬Ò²ÒªÓ¦Óÿ⺯ÊýstrcmpÀ´Åжϡ£
//Êý×é……
char *p = (char *)malloc(100);
strcpy(p, “hello”);
free(p); // the address of “p” is not changed.
….
if (NULL != p) //it will return TRUE
strcpy(p, “world”); //Wrong!!!
ÔÚ¼ÆËãÄÚ´æÈÝÁ¿µÄʱºòÓÐÒ»µãÊDZØÐëÒªÖ¸³öµÄ£¬ÄǾÍÊÇsizeof¼ÆËãÊý×éÊǼÆËãËüµÄʵ¼ÊµÄÄÚ´æÈÝÁ¿£¬¶ø¼ÆËãÖ¸ÕëʱÔòÓÀÔ¶¶¼ÊÇ4¸ö×Ö½Ú¡£C++ÊÇÓÀԶûÓа취֪µÀÖ¸ÕëËùÖ¸µÄÄÚ´æÈÝÁ¿£¬³ý·
Ïà¹ØÎĵµ£º
#include <iostream>
#include <cstdlib>
using namespace std;
class Foo
{
public:
Foo(int ii):i(ii){}
int getInt(){return i;}
private:
int i;
};
class Bar
{
public:
static int FooVal(){c++; return f.getInt();}
int callsFooVal(){return c;}
private:
s ......
I2CÊÇPhillips¿ª·¢µÄ2ÏߵĴ®ÐÐ×ÜÏßÐÒ顣ͨ³£Ó¦ÓÃÔÚǶÈëʽϵͳÖÐÈò»Í¬µÄ×é¼þͨÐÅ£¬PCÖ÷°å¿ÉÒÔͨ¹ýI2CÀ´Ó벻ͬµÄ´«¸ÐÆ÷ͨÐÅ¡£ÕâЩ´«¸ÐÆ÷ͨ³£±¨¸æ·çÉÈËٶȣ¬´¦ÀíÆ÷ζȺÍÕû¸öÓ²¼þϵͳµÄÐÅÏ¢£¬Õâ¸öÐÒéÒ²¿ÉÒÔÓÃÔÚRAM chipsÉÏ£¬Ïò²Ù×÷ϵͳÌṩDIMMµÄÐÅÏ¢¡£
ÔÚ2.0ʱI2CµÄkernelÔ´Âë²»ÔÚÄÚºËÀïµÄ£¬2.4Äں˰üÀ¨ÁËÒ»µã¶ÔI2CµÄÖ§³Ö ......
´ÓCµ½Perl
2008Äê11ÔÂ19ÈÕ ÐÇÆÚÈý 23:06
×÷ÕߣºÍõ´Ï <xiyou.wangcong@gmail.com>
ºÜ¶àÈ˲¢²»ÊÇ°ÑPerlµ±×öµÚÒ»Ãűà³ÌÓïÑÔÀ´Ñ§Ï°µÄ£¬ÔÚѧPerl֮ǰÍùÍùÒѾÕÆÎÕÁË
Ò»Á½ÃÅÆäËüÓïÑÔ¡£ËäÈ»ÓÐÕùÒ飬µ«ÊÇÎÒ¸öÈËÈÏΪPerlȷʵ²»ÊʺÏ×÷ΪÈëÃÅÓïÑÔ¡£ÕâƪÎÄÕ¾ÍÊÇд¸øÄÇЩÊìϤC¶øÇÒÓÖÏë
ÕÆÎÕPerlµ ......