C/C++¹Ø¼ü×Östatic,const,inline,define,typedef
C/C++¹Ø¼ü×Östatic,const,inline,define,typedef
document.body.oncopy = function() {
if (window.clipboardData) {
setTimeout(function() {
var text = clipboardData.getData("text");
if (text && text.length > 300) {
text = text + "\r\n\n±¾ÎÄÀ´×ÔCSDN²©¿Í£¬×ªÔØÇë±êÃ÷³ö´¦£º" + location.href;
clipboardData.setData("text", text);
}
}, 100);
}
}
Ò»
static
1)
²úÉú±³¾°
Òý³öÔÒò£ºº¯ÊýÄÚ²¿¶¨ÒåµÄ±äÁ¿£¬ÔÚ³ÌÐòÖ´Ðе½ËüµÄ¶¨Ò崦ʱ£¬±àÒëÆ÷ΪËüÔÚÕ»ÉÏ·ÖÅä¿Õ¼ä£¬´ó¼ÒÖªµÀ£¬º¯ÊýÔÚÕ»ÉÏ·ÖÅäµÄ¿Õ¼äÔڴ˺¯ÊýÖ´ÐнáÊøʱ»áÊͷŵô£¬ÕâÑù¾Í²úÉúÁËÒ»¸öÎÊÌâ
:
Èç¹ûÏ뽫º¯ÊýÖд˱äÁ¿µÄÖµ±£´æÖÁÏÂÒ»´Îµ÷ÓÃʱ£¬ÈçºÎʵÏÖ£¿
×îÈÝÒ×Ïëµ½µÄ·½·¨ÊǶ¨ÒåÒ»¸öÈ«¾ÖµÄ±äÁ¿£¬µ«¶¨ÒåΪһ¸öÈ«¾Ö±äÁ¿ÓÐÐí¶àȱµã£¬×îÃ÷ÏÔµÄȱµãÊÇÆÆ»µÁ˴˱äÁ¿µÄ·ÃÎÊ·¶Î§£¨Ê¹µÃÔڴ˺¯ÊýÖж¨ÒåµÄ±äÁ¿£¬²»½ö½öÊܴ˺¯Êý¿ØÖÆ£©¡£
ÀàµÄ¾²Ì¬³ÉÔ±Ò²ÊÇÕâ¸öµÀÀí¡£
½â¾ö·½°¸£ºÒò´Ë
C++
ÖÐÒýÈëÁË
static
£¬ÓÃËüÀ´ÐÞÊαäÁ¿£¬ËüÄܹ»Ö¸Ê¾±àÒë
Æ÷½«´Ë±äÁ¿ÔÚ³ÌÐòµÄ¾²Ì¬´æ´¢Çø·ÖÅä¿Õ¼ä±£´æ£¬ÕâÑù¼´ÊµÏÖÁËÄ¿µÄ£¬ÓÖʹµÃ´Ë±äÁ¿µÄ´æÈ¡·¶Î§²»±ä¡£
2)
¾ßÌå×÷ÓÃ
Static
×÷Ó÷ÖÎö×ܽ᣺
static
×ÜÊÇʹµÃ±äÁ¿»ò¶ÔÏóµÄ´æ´¢ÐÎʽ±ä³É¾²Ì¬´æ´¢£¬Á¬½Ó·½Ê½±ä³ÉÄÚ²¿Á¬½Ó£¬¶ÔÓÚ¾Ö²¿±äÁ¿£¨ÒѾÊÇÄÚ²¿Á¬½ÓÁË£©£¬Ëü½ö¸Ä±äÆä´æ´¢·½Ê½£»¶ÔÓÚÈ«¾Ö±äÁ¿£¨ÒѾÊǾ²Ì¬´æ´¢ÁË£©£¬Ëü½ö¸Ä±äÆäÁ¬½ÓÀàÐÍ¡£
(1
Á¬½Ó·½Ê½£º³ÉΪÄÚ²¿Á¬½Ó£»
2
´æ´¢ÐÎʽ£º´æ·ÅÔÚ¾²Ì¬È«¾Ö´æ´¢Çø
)
¶þ
const
1)
²úÉú±³¾°
a) C++
ÓÐÒ»¸öÀàÐÍÑϸñµÄ±àÒëϵͳ£¬ÕâʹµÃ
C++
³ÌÐòµÄ´íÎóÔÚ±àÒë½×¶Î¼´¿É·¢ÏÖÐí¶à£¬´Ó¶øʹµÃ³ö´íÂÊ´óΪ¼õÉÙ£¬Òò´Ë£¬Ò²³ÉΪÁË
C++
Óë
C
Ïà±È£¬ÓÐ×ÅÍ»³öÓŵãµÄÒ»¸ö·½Ãæ¡£
b) C
Öкܳ£¼ûµÄÔ¤´¦ÀíÖ¸Áî
#define VariableName VariableVa
Ïà¹ØÎĵµ£º
Boss˵£¬Òª¿´OpenGL£¬¿´ÁË¿ìÒ»¸öÔ£¬×ÜËã³öÁ˸öÏñÑùµÄ¶«Î÷£¬ÓÃCдÁ˸ö3DÃÔ¹¬£¬
ËäȻֻÓÐ350ÐÐ
´úÂ룬²»¹ý±ßѧ±ßд£¬×ã×ãдÁËÒ»ÖÜʱ¼ä£¬»¹ÊÇСÓгɾ͸еģ¬»î»î»î£¡
&n ......
ÔÚC/C++ÖÐÎÒÃÇÓÐʱΪÁ˽ÚÊ¡ÄÚ´æÕ¼Óÿռ䣬ÐèҪʹÓõ½Î»Óò£¬ÈçÏÂËùʾ´úÂ룺
struct SDummy
{
int A : 2;
int B : 8;
int C : 12;
int D : 10;
};
ÔÚ¼ÆËã»úÄÚ´æ°º¹óµÄÇé¿öÏ£¬Î»Óò²»·¦ÎªÒ»ÖÖÓÐЧµÄ½ÚÊ¡ÄÚ´æÕ¼ÓÿռäÓÖÈôúÂëÊéд±È½ÏͨË×Ò׶®µÄ·½·¨¡£µ«ÊÇÔÚÏÖ½ñÄÚ´æÏà ......
ÉÏ´Î×ܽáÁËC++£¨ÃæÏò¶ÔÏó£©Éè¼ÆµÄºËÐÄ˼Ï룬²¢ÇÒÀý¾ÙÁËʹÓÃÀàÄ£ÐÍÀ´Ìæ´úifºÍswitchµÄÒ»ÖÖ½ÏΪµäÐ͵ÄÇé¿ö¡£ÏÂÃæÏëÀ´Ì¸Ì¸C++ÔÚ±àÂë·½ÃæµÄÌص㡣
ÔںܶྵäµÄC++½Ì³ÌÖж¼ÓÐÒ»¸ö½¨Ò飺Ӧ¾¡Á¿Ê¹Óû§´úÂ루¿âµÄʹÓÃÕߣ©¿´ÆðÀ´¶ÌС¶ø¼òµ¥¡£°´ÕÕ³£Ê¶£¬¼òµ¥µÄ´úÂëͨ³£Òª±È´ó¶ÎµÄ´úÂëºÃÀí½â£¬¶øÓû§´úÂëͨ³£ÊµÏÖµÄÊÇ×îÉϲãµÄ¹¦ÄÜ»òÕ ......
char *strcpy(char *strDes, const char *strSrc)
{
assert((strDes != NULL) && (strSrc != NULL));
char *address = strDes;
while ((*strDes + ......
²Î¿¼¡¶linuxÄÚºËÍêȫעÊÍ¡·ºÍÍøÉÏÏà¹ØÎÄÕÂ
/*
* ¿ØÖÆ̨ÏÔʾ²Ù×÷
*/
/*
* linux/kernel/console.c
*
* (C) 1991 Linus Torvalds
*/
/*
* console.c
*
* This module implements the console io functions
* 'void con_init(v ......