Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

¹ØÓÚC/C++ ±í´ïʽÇóֵ˳Ðò 䶨Òå


±í´ïʽµÄ¸±×÷ÓÃ
ÔËËã·ûµÄÓÅÏȼ¶Óë½áºÏÐԹ涨Á˱í´ïʽÖÐÏàÁÚÁ½¸öÔËËã·ûµÄÔËËã´ÎÐò£¬µ«¶ÔÓÚË«Ä¿
ÔËËãµÄ²Ù×÷Êý£¬C++ûÓй涨ËûÃǵļÆËã´ÎÐò¡£ÀýÈ磬¶ÔÓÚ±í´ïʽ£º
exp1 + exp2;
ÏȼÆËã exp1 »¹ÊÇ exp2£¿²»Í¬µÄ±àÒëÆ÷Óв»Í¬µÄ×ö·¨¡£
ÔÚÊýѧÉÏ£¬¶ÔÓÚË«Ä¿ÔËËã·û£¬²»ÂÛÏȼÆËãÄÄÒ»¸ö²Ù×÷Êý£¬ÒªÇó×îÖÕ¼ÆËã½á¹ûÒ»Ñù¡£
ÔÚ C++ÖУ¬ÔÚ¼ÆËãÒ»¸ö²Ù×÷Êýʱ£¬¸Ã¼ÆËã»á¸Ä±ä£¨Ó°Ï죩ÁíÒ»¸ö²Ù×÷Êý£¬´Ó¶øµ¼ÖÂÒò²Ù
×÷ÊýµÄ²»Í¬¼ÆËã´ÎÐò²úÉú²»Í¬µÄ×îÖÕ¼ÆËã½á¹û¡£¶ÔÓÚÒò²Ù×÷Êý¼ÆËãµÄ´ÎÐò²»Í¬²úÉú²»Í¬
½á¹ûµÄ±í´ïʽΪ´ø¸±×÷Óõıí´ïʽ¡£ÔÚ¼ÆËãʱ»áÓ°ÏìÆäËû²Ù×÷ÊýµÄÖµ£¬ÒýÆð¸±×÷ÓõÄÔË
Ëã·ûΪ´ø¸±×÷ÓõÄÔËËã·û¡£Èç++¡¢– –ÒÔ¼°¸÷ÖÖ¸³ÖµÔËËã·ûΪ´ø¸±×÷ÓõÄÔËËã·û¡£ÀýÈ磺
x=1,(x+2)*(++x)
ÏȼÆËã x+2 ±í´ïʽµÄֵΪ 6¡£
ÈôÏȼÆËã++x£¬ÓÉÓÚÐÞ¸ÄÁË x+2 ÖÐ x µÄÖµ£¬¼ÆËã½á¹ûΪ£¸¡£
ÔÚ C++Öй涨£¬ÏȼÆËãÂß¼­Ó루&&£©ºÍÂß¼­»ò£¨||£©µÄµÚÒ»¸ö²Ù×÷Êý£¬ÔÙ¼ÆËãµÚ¶þ
¸ö²Ù×÷Êý£¬ÒÔ±ã½øÐжÌ·ÇóÖµ¡£Ìõ¼þ£¨?:£©¡¢¶ººÅ£¨,£©ÔËËã·ûÒ²¹æ¶¨Á˲Ù×÷ÊýµÄ¼ÆËã´ÎÐò£¬
³ý´ËÒÔÍ⣬ÆäËûÔËËã·ûûÓй涨²Ù×÷ÊýµÄ¼ÆËã´ÎÐò£¬¼ÆËã´ÎÐòÓɾßÌåµÄ±àÒëÆ÷¾ö¶¨¡£Òò
´ËÔÚº¬ÕâЩÔËËã·ûµÄ±í´ïʽÖУ¬±ÜÃâÔÚ²Ù×÷ÊýÖÐÒýÈë´ø¸±×÷ÓõÄÔËËã·û¡£
±í´ïʽÇóֵ˳Ðò²»Í¬ÓÚÔËËã½áºÏÐÔºÍÓÅÏȼ¶¡£ÏÂÃæÊÇÒ»¸ö¾­µäÀý×Ó£¬±» ISO C99/ C++98 /03 Èý´ó±ê×¼Ã÷È·Ìáµ½£ºËûµÄ½á¹ûÊDz»È·¶¨(unspecified) µÄ¡£ 
i = ++i + 1;   // The behavior is unspecified 
    ÔÚ½éÉܸÅÄî֮ǰ£¬ÎÒÃÇÏȽâÊÍÒ»ÏÂËüµÄ½á¹û¡£Õâ¸ö±í´ïʽ( expression )°üº¬3¸ö×Ó±í´ïʽ( subexpression ): 
e1 =  ++i
e2 = e1  + 1
i = e2
    ÕâÈý¸ö×Ó±í´ïʽ¶¼Ã»ÓÐ˳Ðòµã( sequence point )£¬¶ø ++ i  ºÍ i = e3 ¶¼ÊÇÓи±×÷ÓÃ( side effect )µÄ±í´ïʽ¡£ÓÉÓÚûÓÐ˳Ðòµã£¬ÓïÑÔ²»±£Ö¤ÕâÁ½¸ö¸±×÷ÓõÄ˳Ðò¡£
   ¸ü¼Ó¿ÉŵÄÊÇ£¬Èç¹ûi ÊÇÒ»¸öÄÚ½¨ÀàÐÍ£¬²¢ÔÚÏÂÒ»¸ö˳Ðòµã֮ǰ±»¸Äд³¬¹ýÒ»´Î£¬ÄÇô½á¹ûÊÇ䶨Òå(undefined)µÄ£¡±ÈÈç±¾ÀýÖÐÈç¹ûÓÐ:
int i = 0x1000fffe; 
i = ++i + 1;      // The result is undefined!! 
   ÄãÒ²Ðí»áÈÏΪËûµÄ½á¹ûÊǼÓ1 »òÕß¼Ó2£¬Æäʵ¸üÔã¸â —— ½á¹û¿ÉÄÜÊÇ 0x1001ffff ¡£ËûµÄ¸ß×Ö½Ú½ÓÊÜÁËÒ»¸ö¸±×÷ÓõÄÄÚÈÝ£¬¶øµÍ×Ö½ÚÔò½ÓÊÜ


Ïà¹ØÎĵµ£º

Linux Cµ÷ÊÔÈëÃÅ

1.×Ô¶¨ÒåÊä³ö
  Ïë±Ø´ó¼Ò¶¼ÓÐÀûÓÃÊä³öº¯ÊýÈçprintfÀ´°ïÖúÎÒÃǵ÷ÊÔ³ÌÐòµÄ¾­Àú£¬ÕâÊÇÒ»ÖֱȽÏԭʼµÄ³ÌÐòµ÷ÊÔ¸¨Öú·½·¨£¬ÔÚLinuxÏÂÒ²¿ÉÒÔΪÎÒÃÇËùÓᣲ»¹ýÕâÖÖ·½·¨ÓÐÒ»¸öÃ÷ÏÔµÄȱµã£¬¾ÍÊÇÔÚµ÷ÊÔÍêºóÎÒÃDZØÐë×¢ÊÍ»òɾ³ýµôÕâЩ¸¨Öú´úÂë¡£Linux CÌṩÁË-DDEBUGÕâ¸ö±àÒë±ê¼ÇÀ´¶¨ÒåDEBUGÕâ¸ö·ûºÅ£¬½èÖúÓڸ÷ûºÅ£¬ÎÒÃÇ¿ÉÒÔÔÚÓ¦Ó ......

Indent and Format C Program Source(indent manual)

This is Edition 2.2.10 of `The `indent' Manual', for Indent Version
2.2.10, last updated 23 July 2008.
Copyright (C) 1989, 1992, 1993, 1994, 1995, 1996 Free Software
Foundation, Inc. Copyright (C) 1995, 1996 Joseph Arceneaux. Copyright
(C) 1999 Carlo Wood. Copyright (C) 2001 David Ingamell ......

cÏÝÚåÓëȱÏÝ ÐĵÃÌå»á 1

      ½ñÌì±È½ÏÀÁ¶è£¬Ã»×öÌ⣬ֻÊÇ¿´ÁËÒ»µãÄDZ¾cÏÝÚåÓëȱÏÝ£¬ËµÊµ»°¶ÁÁ˲»¶àµ«Ã÷ÏÔÄܸоõ³öÕâÊÇÒ»±¾ºÃÊ飬¸Ð¾õ¶ÔÎÒÀ´Ëµ¸ÕºÃ£¬²»ÊÇ»ù´¡Ê飬µ«Ò²»ù±¾ÄÜ¿´¶®£¬¶øÇÒÄÜѧµ½ºÃ¶à¶«Î÷£¬µ«½ñÌìÖ»¿´ÁËÈýÕ£¬Ö÷ÒªÊÇϾüÆìÁË£¬囧£¬ÎÒÒ²Ö»ÄÜ°ÑÎÒѧµ½µÄ×ܽáÏÂÀ´£¬Ñ§ÁË×ܱÈÒ»µã¶¼Ã»Ñ§ÒªºÃ£¬ÎÒÒ²Ö»ÄÜÕâÑù°²Î¿×Ô¼ºÁË¡£ ......

C/C++ÓïÑÔvoid¼°voidÖ¸ÕëÉî²ã̽Ë÷

¡¡¡¡1.¸ÅÊö
¡¡¡¡Ðí¶à³õѧÕ߶ÔC/C++ÓïÑÔÖеÄvoid¼°voidÖ¸ÕëÀàÐͲ»ÉõÀí½â£¬Òò´ËÔÚʹÓÃÉϳöÏÖÁËһЩ´íÎó¡£±¾ÎĽ«¶Ôvoid¹Ø¼ü×ÖµÄÉî¿Ìº¬Òå½øÐнâ˵£¬²¢ÏêÊövoid¼°voidÖ¸ÕëÀàÐ͵ÄʹÓ÷½·¨Óë¼¼ÇÉ¡£
¡¡¡¡2.voidµÄº¬Òå
¡¡¡¡voidµÄ×ÖÃæÒâ˼ÊÇ“ÎÞÀàÐÍ”£¬void *ÔòΪ“ÎÞÀàÐÍÖ¸Õ딣¬void *¿ÉÒÔÖ¸ÏòÈκÎÀàÐ͵ÄÊ ......

´´½¨ÖîÈç "c:\a\b\c\d\yeah.log"Öеĸ÷¼¶Îļþ¼Ð

×î½üά»¤Logger¹²Ïí¿âµÄʱºòÐÂÔöÁ˸üÈËÐÔ»¯µÄ×Ô¶¯´´½¨¸÷¼¶Ä¿Â¼µÄ¹¦ÄÜ£¬ÏÂÃæÊÇÎÒʵÏÖ´´½¨ÖîÈç "c:\a\b\c\d\yeah.log"Öеĸ÷¼¶Îļþ¼ÐµÄ¹ý³Ì£¬Çë´ó¼ÒÖ¸½Ì£¡
BOOL CreateDirectoryInPathW(const wchar_t *sLogPath)
{
 static BOOL bRet = 0;
 CString csFullDir(_T(""));//ԭʼȫ·¾¶
 int nLen = 0;//Ô­Ê ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ