c ºê¶¨Òå
¹ØÓÚ#ºÍ##ÔÚCÓïÑԵĺêÖУ¬#µÄ¹¦ÄÜÊǽ«ÆäºóÃæµÄºê²ÎÊý½øÐÐ×Ö·û´®»¯²Ù×÷£¨Stringfication£©£¬¼òµ¥Ëµ¾ÍÊÇÔÚ¶ÔËüËùÒýÓõĺê±äÁ¿Í¨¹ýÌæ»»ºóÔÚÆä×óÓÒ¸÷¼ÓÉÏÒ»¸öË«ÒýºÅ¡£±ÈÈçÏÂÃæ´úÂëÖеĺ꣺
#define WARN_IF(EXP) \
do{ if (EXP) \
fprintf(stderr, "Warning: " #EXP "\n"); } \
while(0)
ÄÇôʵ¼ÊʹÓÃÖлá³öÏÖÏÂÃæËùʾµÄÌæ»»¹ý³Ì£º
WARN_IF (divider == 0);
±»Ì滻Ϊ
do {
if (divider == 0)
fprintf(stderr, "Warning" "divider == 0" "\n");
} while(0);
ÕâÑùÿ´Îdivider£¨³ýÊý£©Îª0µÄʱºò±ã»áÔÚ±ê×¼´íÎóÁ÷ÉÏÊä³öÒ»¸öÌáʾÐÅÏ¢¡£
¶ø##±»³ÆΪÁ¬½Ó·û£¨concatenator£©£¬ÓÃÀ´½«Á½¸öTokenÁ¬½ÓΪһ¸öToken¡£×¢ÒâÕâÀïÁ¬½ÓµÄ¶ÔÏóÊÇToken¾ÍÐУ¬¶ø²»Ò»¶¨ÊǺêµÄ±äÁ¿¡£±ÈÈçÄãÒª×öÒ»¸ö²Ëµ¥ÏîÃüÁîÃûºÍº¯ÊýÖ¸Õë×é³ÉµÄ½á¹¹ÌåµÄÊý×飬²¢ÇÒÏ£ÍûÔÚº¯ÊýÃûºÍ²Ëµ¥ÏîÃüÁîÃûÖ®¼äÓÐÖ±¹ÛµÄ¡¢Ãû×ÖÉϵĹØϵ¡£ÄÇôÏÂÃæµÄ´úÂë¾Í·Ç³£ÊµÓãº
struct command
{
char * name;
void (*function) (void);
};
#define COMMAND(NAME) { NAME, NAME ## _command }
// È»ºóÄã¾ÍÓÃһЩԤÏȶ¨ÒåºÃµÄÃüÁîÀ´·½±ãµÄ³õʼ»¯Ò»¸öcommand½á¹¹µÄÊý×éÁË£º
struct command commands[] = {
COMMAND(quit),
COMMAND(help),
...
}
COMMANDºêÔÚÕâÀï³äµ±Ò»¸ö´úÂëÉú³ÉÆ÷µÄ×÷Óã¬ÕâÑù¿ÉÒÔÔÚÒ»¶¨³Ì¶ÈÉϼõÉÙ´úÂëÃܶȣ¬¼ä½ÓµØÒ²¿ÉÒÔ¼õÉÙ²»ÁôÐÄËùÔì³ÉµÄ´íÎó¡£ÎÒÃÇ»¹¿ÉÒÔn¸ö##·ûºÅÁ¬½Ó n+1¸öToken£¬Õâ¸öÌØÐÔÒ²ÊÇ#·ûºÅËù²»¾ß±¸µÄ¡£±ÈÈ磺
#define LINK_MULTIPLE(a,b,c,d) a##_##b##_##c##_##d
typedef struct _record_type LINK_MULTIPLE(name,company,position,salary);
// ÕâÀïÕâ¸öÓï¾ä½«Õ¹¿ªÎª£º
// typedef struct _record_type name_company_position_salary;
¹ØÓÚ...µÄʹÓÃ
...ÔÚCºêÖгÆΪVariadic Macro£¬Ò²¾ÍÊDZä²Îºê¡£±ÈÈ磺
#define myprintf(templt,...) fprintf(stderr,templt,__VA_ARGS__)
// »òÕß
#define myprintf(templt,args...) fprintf(stderr,templt,args)
µÚÒ»¸öºêÖÐÓÉÓÚûÓжԱä²ÎÆðÃû£¬ÎÒÃÇÓÃĬÈϵĺê__VA_ARGS__À´Ìæ´úËü¡£µÚ¶þ¸öºêÖУ¬ÎÒÃÇÏÔʽµØÃüÃû±ä²ÎΪargs£¬ÄÇôÎÒÃÇÔں궨ÒåÖоͿÉÒÔÓÃargsÀ´´úÖ¸±ä²ÎÁË¡£Í¬CÓïÑÔµÄstd
Ïà¹ØÎĵµ£º
ANSI C±ê×¼ÖÐÓм¸¸ö±ê×¼Ô¤¶¨Òåºê£º__FILE__ __DATE__ __TIME___ __LINE__ µÈ
__LINE__£ºÔÚÔ´´úÂëÖвåÈ뵱ǰԴ´úÂëÐкţ»
__FILE__£ºÔÚÔ´ÎļþÖвåÈ뵱ǰԴÎļþÃû£»
__DATE__£ºÔÚÔ´ÎļþÖвåÈ뵱ǰµÄ±àÒëÈÕÆÚ
__TIME__£ºÔÚÔ´ÎļþÖвåÈ뵱ǰ±àÒëʱ¼ä£»
......
×î½üһֱæ±ÏÒµµÄÏà¹ØÊÂÇ飬¼ÓÉϹ¤×÷£¬×ªÑۼ䣬ÓÖµ½Ôµ×ÁË£¬Ö®Ç°³ÐŵµÄÿÔÂһƪ²©ÎÄ£¬Ç°¼¸Ìì¾ÍÒ»Ö±ÔÚÑ°ÕÒµ½µ×Ҫдʲô£¬½üÁ½ÌìÓÖͻȻ·¢ÏÖÓкܶණÎ÷¿ÉÒÔд¡£±¾Æª¾ÍÏÈÑÓÐø֮ǰµÄһƪ»ùÓÚCookieµÄ°²È«¼ì²é»úÖÆ£¨ÉîÈëC/C++Ö®»ùÓÚCookieµÄ°²È«¼ì²é£¨VS2005£©£©À´½éÉÜÏÂÁíÍâÒ»ÖÖÔÚDEBUG°æ±¾Ïµİ²È«¼ì²é£¬Ò²¾ÍÊÇCheckStackVars¼ì ......
½â¾ö²½Ö裺
gylu@dell-desktop:~$ sudo apt-get install ckermit
ÏÔʾ°²×°¹ý³Ì
gylu@dell-desktop:~$gedit ~/.kermrc
ÊäÈëÏÂÃæÄÚÈݺ󱣴æ.kermrcÍ˳ö:
set line /dev/ttyS0
set speed & ......
¹æÔò»ò½¨Ò顣ÿÌõ×¼Ôò¶¼ÓÐÀýÍâ
1£¬¼ÙÏëµÄ±àÒë³ÌÐò
ʹÓñàÒë³ÌÐòËùÓеĿÉÑ¡¾¯¸æÉèÊ©
ʹÓÃlintÀ´²é³ö±àÒë³ÌÐò©µôµÄ´íÎó
Èç¹ûÓе¥Ôª²âÊÔ£¬¾Í½øÐе¥Ôª²âÊÔ
2£¬×Ô¼ºÉè¼Æ²¢Ê¹ÓöÏÑÔ
¼ÈҪά»¤³ÌÐòµÄ½»¸¶°æ±¾£¬ÓÖҪά»¤³ÌÐòµÄµ÷ÊÔ°æ±¾
ҪʹÓöÏÑÔ¶Ôº¯Êý²ÎÊý½øÐÐÈ·ÈÏ
Òª´Ó³ÌÐòÖÐɾȥÎÞ¶¨ÒåµÄÌØÐÔ£¬»òÕßÔÚ³ÌÐòÖÐʹÓöÏÑÔÀ´¼ ......
/*
* File: main.cpp
* Author: Vicky
*
* Created on 2010Äê5ÔÂ8ÈÕ, ÏÂÎç2:47
*/
#include <iostream>
using namespace std;
class A{
public:
A(){
cout << "Ö´Ðй¹Ô캯Êý´´½¨Ò»¸ö¶ÔÏó" << endl;
}
A(A&){
cout << "Ö´Ðп½±´º¯Êý¿½±´Ò»¸ö¶ ......