锘??xml version="1.0" encoding="utf-8" standalone="yes"?>久久精品亚洲AV久久久无码,99久久精品国内,国产精品岛国久久久久http://www.shnenglu.com/sandy/category/767.html楂樻ц兘鏈嶅姟鍣ㄧ璁$畻zh-cnMon, 04 Jun 2012 01:32:26 GMTMon, 04 Jun 2012 01:32:26 GMT60閫嗗悜涓夊浗緹よ嫳2http://www.shnenglu.com/sandy/archive/2012/05/31/176971.html灝忔槑灝忔槑Thu, 31 May 2012 13:53:00 GMThttp://www.shnenglu.com/sandy/archive/2012/05/31/176971.htmlhttp://www.shnenglu.com/sandy/comments/176971.htmlhttp://www.shnenglu.com/sandy/archive/2012/05/31/176971.html#Feedback1http://www.shnenglu.com/sandy/comments/commentRss/176971.htmlhttp://www.shnenglu.com/sandy/services/trackbacks/176971.html

闂叉潵鏃犱簨錛屾悶鎼為嗗悜宸ョ▼鍒嗘瀽涓涓嬩笁鍥界兢鑻?/span>2錛屼粖澶╃殑鐩爣鏄幓鎺夊厜鐩樻彁紺?騫惰娓告垙姝e父榪涜銆傚洜涓烘垜鐜╃殑鏄師鐗堬紝鎵浠ユ瘡褰撶洿鎺ヨ繍琛宻ango2.exe浼氬脊鍑哄涓嬪璇濇:



鎴戜嬌鐢ㄧ殑宸ュ叿鏄ぇ鍚嶉紟榧庣殑OllyDBG銆?/span>

棣栧厛錛屾墦寮OD,鎵撳紑sango2.exe, 榪愯紼嬪簭錛屽綋鍑虹幇瀵硅瘽妗嗘椂鏆傛椂紼嬪簭錛屽彂鐜板仠鍦ㄦ澶勶細


浠旂粏鐪嬩互涓嬪嚑琛屼唬鐮侊紝鍙互鐪嬪嚭鍦?0B207澶勬湁涓涓垽鏂紝濡傛灉EAX=0錛屽垯涓嶆樉紺哄璇濇錛屽茍璺寵漿鍒?0B21F錛岄偅濡傛灉鎴戜滑鎶夿207鐨?#8220;JE SHORT 0040B21F”鏀逛負“JNE SHORT 0040B21F”,鏄惁灝卞彲浠ヤ笉鏄劇ず瀵硅瘽妗嗗憿錛熺粡嫻嬭瘯錛岀‘瀹炰笉鏄劇ず浜嗭紝浣嗘槸娓告垙涔熺洿鎺ラ鍑轟簡錛屽茍娌℃湁杈懼埌鎴戜滑瑕佺殑鏁堟灉銆傜湅鏉ヨ繖涓湴鏂瑰彧鏄嚭閿欏悗鐨勭▼搴忓鐞嗭紝鎴戜滑瑕佹壘鍒版洿娣辯殑婧愬ご錛屾墠鑳借В鍐寵繖涓棶棰樸?/span>



涓婃柇鐐癸紒鎴戜滑瑕佺粨鍚堝崟姝ヨ皟璇曟潵鐞嗚В紼嬪簭鐨勮繍琛岄昏緫鎵嶈兘鍙戠幇鐪熸鐨勮В鍐蟲柟妗堛?/span>

瑙傚療瀵硅瘽妗嗗嚭鐜扮殑鏃跺欙紝紼嬪簭鐨勫爢鏍堝涓嬶細



鍙戠幇榪欎釜鍑芥暟鐨勫叆鍙e湪40B00A錛屾垜浠湪姝よ緗柇鐐瑰紑濮嬪崟姝ヨ皟璇曪紝浼氬彂鐜板湪璋冪敤4300F0鍑虹幇瀵硅瘽妗嗭紝璺熻釜榪涘幓銆?/span>


鐢ㄨ繖鏍風殑鏂規硶璺熻釜榪涘幓錛屼繚鎸佽愬績鍜屾竻閱掔殑澶磋剳錛屾渶緇堜細鍙戠幇4302C8浼氳繘琛岄敊璇鐞嗭紝瀵艱嚧瀵硅瘽妗嗙殑鍑虹幇錛屽彧瑕佽煩榪囧嵆鍙傛垜浠慨鏀?302C1鐨勪唬鐮佷負"JZ short 004302D1"錛屽嵆鍙煩榪囧璇濇錛岀洿鎺ヨ繘琛屾父鎴忋?/span>



鏈鍚庝竴姝ワ紝鍑鴻ˉ涓併備嬌鐢ㄥ彸閿姛鑳姐?/span>copy to executable銆戯紝鐒跺悗鍙﹀瓨涓哄彲鎵ц鏂囦歡灝卞彲浠ヤ簡銆傝繍琛屼慨鏀硅繃鍚庣殑sango2.exe錛屽氨浼氬彂鐜板凡緇忕牬瑙f垚鍔熶簡銆?/span>




灝忔槑 2012-05-31 21:53 鍙戣〃璇勮
]]>
debug to fix crashhttp://www.shnenglu.com/sandy/archive/2012/04/27/172918.html灝忔槑灝忔槑Fri, 27 Apr 2012 07:34:00 GMThttp://www.shnenglu.com/sandy/archive/2012/04/27/172918.htmlhttp://www.shnenglu.com/sandy/comments/172918.htmlhttp://www.shnenglu.com/sandy/archive/2012/04/27/172918.html#Feedback4http://www.shnenglu.com/sandy/comments/commentRss/172918.htmlhttp://www.shnenglu.com/sandy/services/trackbacks/172918.html闃呰鍏ㄦ枃

灝忔槑 2012-04-27 15:34 鍙戣〃璇勮
]]>
閭d簺leveldb浣跨敤鐨勫鎶娣閥1-鍐呭瓨綆$悊http://www.shnenglu.com/sandy/archive/2012/03/28/leveldb-trick1.html灝忔槑灝忔槑Wed, 28 Mar 2012 10:00:00 GMThttp://www.shnenglu.com/sandy/archive/2012/03/28/leveldb-trick1.htmlhttp://www.shnenglu.com/sandy/comments/169303.htmlhttp://www.shnenglu.com/sandy/archive/2012/03/28/leveldb-trick1.html#Feedback1http://www.shnenglu.com/sandy/comments/commentRss/169303.htmlhttp://www.shnenglu.com/sandy/services/trackbacks/169303.html闃呰鍏ㄦ枃

灝忔槑 2012-03-28 18:00 鍙戣〃璇勮
]]>
濂囨殑g++鐨勮涓?/title><link>http://www.shnenglu.com/sandy/archive/2008/08/13/58733.html</link><dc:creator>灝忔槑</dc:creator><author>灝忔槑</author><pubDate>Wed, 13 Aug 2008 08:56:00 GMT</pubDate><guid>http://www.shnenglu.com/sandy/archive/2008/08/13/58733.html</guid><wfw:comment>http://www.shnenglu.com/sandy/comments/58733.html</wfw:comment><comments>http://www.shnenglu.com/sandy/archive/2008/08/13/58733.html#Feedback</comments><slash:comments>18</slash:comments><wfw:commentRss>http://www.shnenglu.com/sandy/comments/commentRss/58733.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/sandy/services/trackbacks/58733.html</trackback:ping><description><![CDATA[     鎽樿: 濂囨殑g++鐨勮涓?nbsp; <a href='http://www.shnenglu.com/sandy/archive/2008/08/13/58733.html'>闃呰鍏ㄦ枃</a><img src ="http://www.shnenglu.com/sandy/aggbug/58733.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/sandy/" target="_blank">灝忔槑</a> 2008-08-13 16:56 <a href="http://www.shnenglu.com/sandy/archive/2008/08/13/58733.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>printf鐨剋rapperhttp://www.shnenglu.com/sandy/archive/2007/10/12/34022.html灝忔槑灝忔槑Fri, 12 Oct 2007 06:13:00 GMThttp://www.shnenglu.com/sandy/archive/2007/10/12/34022.htmlhttp://www.shnenglu.com/sandy/comments/34022.htmlhttp://www.shnenglu.com/sandy/archive/2007/10/12/34022.html#Feedback0http://www.shnenglu.com/sandy/comments/commentRss/34022.htmlhttp://www.shnenglu.com/sandy/services/trackbacks/34022.html闃呰鍏ㄦ枃

灝忔槑 2007-10-12 14:13 鍙戣〃璇勮
]]>
濡備綍鍐欏嚭涓撲笟鐨凜澶存枃浠?/title><link>http://www.shnenglu.com/sandy/archive/2007/05/15/24151.html</link><dc:creator>灝忔槑</dc:creator><author>灝忔槑</author><pubDate>Tue, 15 May 2007 05:38:00 GMT</pubDate><guid>http://www.shnenglu.com/sandy/archive/2007/05/15/24151.html</guid><wfw:comment>http://www.shnenglu.com/sandy/comments/24151.html</wfw:comment><comments>http://www.shnenglu.com/sandy/archive/2007/05/15/24151.html#Feedback</comments><slash:comments>7</slash:comments><wfw:commentRss>http://www.shnenglu.com/sandy/comments/commentRss/24151.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/sandy/services/trackbacks/24151.html</trackback:ping><description><![CDATA[     鎽樿: 浠巐ua婧愮爜涓鍒扮殑涓鐐瑰皬涓滆タ  <a href='http://www.shnenglu.com/sandy/archive/2007/05/15/24151.html'>闃呰鍏ㄦ枃</a><img src ="http://www.shnenglu.com/sandy/aggbug/24151.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/sandy/" target="_blank">灝忔槑</a> 2007-05-15 13:38 <a href="http://www.shnenglu.com/sandy/archive/2007/05/15/24151.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>C++婧愭枃浠剁紪鐮侀棶棰?/title><link>http://www.shnenglu.com/sandy/archive/2007/04/05/21320.html</link><dc:creator>灝忔槑</dc:creator><author>灝忔槑</author><pubDate>Thu, 05 Apr 2007 07:30:00 GMT</pubDate><guid>http://www.shnenglu.com/sandy/archive/2007/04/05/21320.html</guid><wfw:comment>http://www.shnenglu.com/sandy/comments/21320.html</wfw:comment><comments>http://www.shnenglu.com/sandy/archive/2007/04/05/21320.html#Feedback</comments><slash:comments>6</slash:comments><wfw:commentRss>http://www.shnenglu.com/sandy/comments/commentRss/21320.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/sandy/services/trackbacks/21320.html</trackback:ping><description><![CDATA[     鎽樿: C++婧愭枃浠剁紪鐮侀棶棰?nbsp; <a href='http://www.shnenglu.com/sandy/archive/2007/04/05/21320.html'>闃呰鍏ㄦ枃</a><img src ="http://www.shnenglu.com/sandy/aggbug/21320.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/sandy/" target="_blank">灝忔槑</a> 2007-04-05 15:30 <a href="http://www.shnenglu.com/sandy/archive/2007/04/05/21320.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>{Just for fun} 濡備綍璁╂寚閽堟寚鍚戣嚜宸?/title><link>http://www.shnenglu.com/sandy/archive/2007/04/04/21229.html</link><dc:creator>灝忔槑</dc:creator><author>灝忔槑</author><pubDate>Wed, 04 Apr 2007 04:16:00 GMT</pubDate><guid>http://www.shnenglu.com/sandy/archive/2007/04/04/21229.html</guid><wfw:comment>http://www.shnenglu.com/sandy/comments/21229.html</wfw:comment><comments>http://www.shnenglu.com/sandy/archive/2007/04/04/21229.html#Feedback</comments><slash:comments>8</slash:comments><wfw:commentRss>http://www.shnenglu.com/sandy/comments/commentRss/21229.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/sandy/services/trackbacks/21229.html</trackback:ping><description><![CDATA[     鎽樿: 濡備綍璁╂寚閽堟寚鍚戣嚜宸?nbsp; <a href='http://www.shnenglu.com/sandy/archive/2007/04/04/21229.html'>闃呰鍏ㄦ枃</a><img src ="http://www.shnenglu.com/sandy/aggbug/21229.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/sandy/" target="_blank">灝忔槑</a> 2007-04-04 12:16 <a href="http://www.shnenglu.com/sandy/archive/2007/04/04/21229.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>[STL] 寰幆涓璭rasehttp://www.shnenglu.com/sandy/archive/2006/12/27/16913.html灝忔槑灝忔槑Wed, 27 Dec 2006 10:01:00 GMThttp://www.shnenglu.com/sandy/archive/2006/12/27/16913.htmlhttp://www.shnenglu.com/sandy/comments/16913.htmlhttp://www.shnenglu.com/sandy/archive/2006/12/27/16913.html#Feedback11http://www.shnenglu.com/sandy/comments/commentRss/16913.htmlhttp://www.shnenglu.com/sandy/services/trackbacks/16913.html闃呰鍏ㄦ枃

灝忔槑 2006-12-27 18:01 鍙戣〃璇勮
]]>
璋堣皥snprintfhttp://www.shnenglu.com/sandy/archive/2006/09/29/13133.html灝忔槑灝忔槑Fri, 29 Sep 2006 02:27:00 GMThttp://www.shnenglu.com/sandy/archive/2006/09/29/13133.htmlhttp://www.shnenglu.com/sandy/comments/13133.htmlhttp://www.shnenglu.com/sandy/archive/2006/09/29/13133.html#Feedback7http://www.shnenglu.com/sandy/comments/commentRss/13133.htmlhttp://www.shnenglu.com/sandy/services/trackbacks/13133.html闃呰鍏ㄦ枃

灝忔槑 2006-09-29 10:27 鍙戣〃璇勮
]]>
STL 澶囧繕褰?/title><link>http://www.shnenglu.com/sandy/archive/2006/07/12/9721.html</link><dc:creator>灝忔槑</dc:creator><author>灝忔槑</author><pubDate>Wed, 12 Jul 2006 03:19:00 GMT</pubDate><guid>http://www.shnenglu.com/sandy/archive/2006/07/12/9721.html</guid><wfw:comment>http://www.shnenglu.com/sandy/comments/9721.html</wfw:comment><comments>http://www.shnenglu.com/sandy/archive/2006/07/12/9721.html#Feedback</comments><slash:comments>14</slash:comments><wfw:commentRss>http://www.shnenglu.com/sandy/comments/commentRss/9721.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/sandy/services/trackbacks/9721.html</trackback:ping><description><![CDATA[     鎽樿: 浣跨敤鏍囧噯搴撳簲璇ヨ浣忕殑涓浜涗笢瑗?21鏉?  <a href='http://www.shnenglu.com/sandy/archive/2006/07/12/9721.html'>闃呰鍏ㄦ枃</a><img src ="http://www.shnenglu.com/sandy/aggbug/9721.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/sandy/" target="_blank">灝忔槑</a> 2006-07-12 11:19 <a href="http://www.shnenglu.com/sandy/archive/2006/07/12/9721.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>G11N Developement (2) --- Linux Best Practicehttp://www.shnenglu.com/sandy/archive/2006/06/26/9020.html灝忔槑灝忔槑Mon, 26 Jun 2006 08:57:00 GMThttp://www.shnenglu.com/sandy/archive/2006/06/26/9020.htmlhttp://www.shnenglu.com/sandy/comments/9020.htmlhttp://www.shnenglu.com/sandy/archive/2006/06/26/9020.html#Feedback0http://www.shnenglu.com/sandy/comments/commentRss/9020.htmlhttp://www.shnenglu.com/sandy/services/trackbacks/9020.htmlftp://ftp.gnu.org/gnu/gettext/ ) 鍜宭ibiconv(http://www.gnu.org/software/libiconv/) ,鍓嶈呮槸鐢ㄤ簬瀹炵幇Resource bundle,鑰屽悗鑰呯敤浜庡悇縐嶇紪鐮佽漿鍖栥?br>
(娉?榪欓噷娌℃湁鑰冭檻cross-platform)


1. 瀹炵幇鏂規硶

a . 浣跨敤po鏂囦歡浣滀負璧勬簮鏂囦歡 (寤鴻緙栫爜鏄痷tf-8)
    涓鏂歸潰鍥犱負UTF-8鍏煎ANSI,鍙﹀涓鏂歸潰鑰冭檻鍒癎11N鐨勭▼搴忓ぇ閮ㄥ垎浣跨敤utf-8杈撳嚭錛屾瘮濡傝緭鍑哄埌database,web UI, file絳夌瓑銆?br>
b. 浣跨敤getext浠巖esource file ( mo鏂囦歡)璇誨埌鐩稿簲鐨凩10N resource鏂囦歡
   娉ㄦ剰榪欓噷闇瑕佸厛setlocale鏉ヨ緗甽ocale
#include <stdio.h>
#include 
<locale.h>
#include 
<libintl.h>

#define _(string) gettext (string)

int main(int argc, char **argv)
{
    
if (setlocale(LC_ALL, “”) == NULL) {
        fprintf(stderr, “setlocale() error.\n”);
        
return -1;
}
if (bindtextdomain(package, “/usr/share/locale”) == NULL) {
    fprintf(stderr, “bindtextdomain() error.\n”);
    
return –1;
}
    
if (textdomain(package) == NULL) {
        fprintf(stderr, “textdomain() error.\n”);
        
return –1;
}
    printf(“
%s\n”, _(“Hello, world!”));
    
return 0;
}


c.濡傛灉瑕佽緭鍑哄埌鎺у埗鍙?console),鍥犱負涓嶆槸console閮芥敮鎸乽nicode output錛屾墍浠ユ帹鑽愮殑鏂規硶鏄鍏堟槸鎶妘tf-8杞寲涓烘湰鍦扮紪鐮侊紝鐒跺悗浣跨敤printf杈撳嚭銆備笉鎺ㄨ崘浣跨敤wprintf榪涜杈撳嚭錛屼竴鏂歸潰鏄洜涓簑char_t鐨勫ぇ灝忛殢緙栬瘧鍣ㄤ笉鍚岋紝涓嶅ソ鎺у埗銆傚彟澶栦竴鏂歸潰錛屽緢澶歸printf鐨勫疄鐜頒篃閮芥槸鍏堟妸wchar_t[]杞負鏈湴緙栫爜錛岀劧鍚庤緭鍑恒傝漿鍖栫紪鐮佷嬌鐢╨ibconv

d.濡傛灉瑕佽緭鍑哄埌web pages,database,file錛岀紪鐮佹帹鑽愪嬌鐢╱tf-8.

e.濡傛灉瑕佽緭鍑烘湰鍦板寲鐨勬棩鏈熷拰鏃墮棿錛屼嬌鐢ˋPI: strftime
#include <stdio.h>
#include 
<time.h>
int main(int argc, char **argv) 
{
    time_t t;
    
struct tm *ptm;
    
char buffer[100];

    memset(buffer, 
0sizeof(buffer));
    
if (time(&t) < 0) {
        fprintf(stderr, “time() error: 
%m\n”);
    }
    
if ((ptm = localtime(&t)) == NULL) {
        fprintf(stderr, “localtime() error: 
%m\n”);
    }
    strftime(buffer, 
sizeof(buffer), “%%X”, ptm);
    printf(“
%s\n”, buffer);
    
return 0;
}


f. 濡傛灉瑕佽緭鍑烘湰鍦板寲鐨勬暟瀛楀拰璐у竵錛屼嬌鐢ˋPI: strfmon
#include <stdio.h>
#include 
<monetary.h>

int main(int argc, char **argv)
{
    
char buffer[100];
    strfmon(buffer, 
sizeof(buffer), “%=*i", 12345.67);
    printf(“%s\n”, buffer);
    
return 0;
}


2.鐩綍緇撴瀯
/product
  /i18n
      /zh_TW
          your.mo
      /ja_JP 
          your.mo



灝忔槑 2006-06-26 16:57 鍙戣〃璇勮
]]>
娣卞叆 printf / wprintf / console涓嬬殑unicode outputhttp://www.shnenglu.com/sandy/archive/2006/06/21/8779.html灝忔槑灝忔槑Wed, 21 Jun 2006 03:53:00 GMThttp://www.shnenglu.com/sandy/archive/2006/06/21/8779.htmlhttp://www.shnenglu.com/sandy/comments/8779.htmlhttp://www.shnenglu.com/sandy/archive/2006/06/21/8779.html#Feedback5http://www.shnenglu.com/sandy/comments/commentRss/8779.htmlhttp://www.shnenglu.com/sandy/services/trackbacks/8779.html渚嬪:
wchar_t聽test[]=L"嫻嬭瘯1234";
printf(
"%s",test);
鏄笉浼氭紜緭鍑虹殑


2.wprintf 鍚屾牱涓嶄細鎻愪緵unicode output,
聽聽 浣嗘槸浠栦細鎶妛char_t鐨剆tring杞負locale鐨凷B/MB瀛楃緙栫爜錛岀劧鍚庤緭鍑?br />渚嬪錛?br />
wchar_t聽test[]聽=聽L"嫻嬭瘯Test";
wprintf(L
"%s",test);
浼氳緭鍑??1234涔嬬被鐨勫瓧絎︿覆錛屾垨鑰呬笉杈撳嚭浠諱綍緇撴灉
鍥犱負wprintf娌℃湁鍔炴硶鎶奓"嫻嬭瘯Test"杞負榛樿鐨凙NSI,闇瑕佽緗甽ocale
setlocale(LC_ALL,"chs");
wchar_t聽test[]聽
=聽L"嫻嬭瘯Test";
wprintf(L
"%s",test);
浼氭湁姝g‘鐨勮緭鍑?br />絳夊悓浜巔rintf("%ls",test);

緇間笂:聽 CRT I/O functions do not provide Unicode output.

3. Window console鑷粠NT4灝辨槸涓涓湡姝g殑unicode console
涓嶈繃杈撳嚭unicode string,鍙湁浣跨敤Windows API, WriteConsoleW
渚嬪錛?br />
wchar_t聽test[]聽=聽L"嫻嬭瘯1234";
DWORD聽ws;
WriteConsoleW(GetStdHandle(STD_OUTPUT_HANDLE),test,wcslen(test),
&ws,NULL);
鍙互姝g‘鐨勮緭鍑鴻屼笉闇瑕佽緗甽ocale,鍥犱負鏄湡姝g殑unicode鐨勮緭鍑猴紝璺焎odepage鏃犲叧

4. 濡備綍瀹炵幇璺ㄥ鉤鍙扮殑console output
聽聽聽 涓嶈浣跨敤wchar_t鍜寃printf,鍥犱負榪欎簺閮戒緷璧栦簬緙栬瘧鍣?
聽聽聽聽 ICU鏄疘BM鐨勪竴涓垚鐔熺殑璺ㄥ鉤鍙版敮鎸乽nicode鐨刲ibary,鎺ㄨ崘浣跨敤

浠ヤ笅鏄疘CU鐨剈printf瀹炵幇

void聽uprintf(const聽UnicodeString聽&str)聽{
聽聽聽聽
char*buf聽=0;
聽聽聽聽int32_t聽len聽
=聽str.length();
聽聽聽聽int32_t聽bufLen聽
=聽len聽+16;
聽聽聽聽int32_t聽actualLen;
聽聽聽聽buf聽
=newchar[bufLen聽+1];
聽聽聽聽actualLen聽
=聽str.extract(0,聽len,聽buf/*,聽bufLen*/);聽//聽Default聽codepage聽conversion
聽聽聽聽buf[actualLen]聽=0;
聽聽聽聽printf(
"%s",聽buf);
聽聽聽聽delete聽buf;
}
瀹冧篃鏄厛鎶奤nicode string杞寲涓烘湰鍦扮殑codepage,鐒跺悗printf錛岃櫧鐒朵篃涓嶆槸unicode output,浣嗘槸璺ㄥ鉤鍙幫紝澶у鏁版儏鍐典細宸ヤ綔寰楀緢濂姐?br />


灝忔槑 2006-06-21 11:53 鍙戣〃璇勮
]]>
G11N Development(1) --- Unicode Basic && wxxx functionhttp://www.shnenglu.com/sandy/archive/2006/06/19/8722.html灝忔槑灝忔槑Mon, 19 Jun 2006 11:45:00 GMThttp://www.shnenglu.com/sandy/archive/2006/06/19/8722.htmlhttp://www.shnenglu.com/sandy/comments/8722.htmlhttp://www.shnenglu.com/sandy/archive/2006/06/19/8722.html#Feedback1http://www.shnenglu.com/sandy/comments/commentRss/8722.htmlhttp://www.shnenglu.com/sandy/services/trackbacks/8722.html闃呰鍏ㄦ枃

灝忔槑 2006-06-19 19:45 鍙戣〃璇勮
]]>
婕皥鍑芥暟鐨勮繑鍥炲?/title><link>http://www.shnenglu.com/sandy/archive/2006/04/25/6252.html</link><dc:creator>灝忔槑</dc:creator><author>灝忔槑</author><pubDate>Tue, 25 Apr 2006 08:55:00 GMT</pubDate><guid>http://www.shnenglu.com/sandy/archive/2006/04/25/6252.html</guid><wfw:comment>http://www.shnenglu.com/sandy/comments/6252.html</wfw:comment><comments>http://www.shnenglu.com/sandy/archive/2006/04/25/6252.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.shnenglu.com/sandy/comments/commentRss/6252.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/sandy/services/trackbacks/6252.html</trackback:ping><description><![CDATA[鍦╳indows鐨勪笘鐣岄噷闈紝寰堝皯鏈堿PI娌℃湁榪斿洖鍊箋備絾鏄埌搴曡繑鍥炰粈涔堜唬琛ㄦ垚鍔燂紝榪欎釜娌℃湁鏍囧噯銆傛垜鍙戠幇涓昏鏈変笁縐嶆ā寮?br /><br /><strong>1 . 榪斿洖闈?琛ㄧず鎴愬姛錛岃繑鍥?琛ㄧず澶辮觸</strong><br /><br />澶у鏁癢in32 Platform API閮芥槸榪欐牱,姣斿<br /><br /><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">聽result聽</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">MoveFileEx(szTempName,聽<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">allcaps.txt</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">,聽<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽MOVEFILE_REPLACE_EXISTING);<br /><br /></span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(</span><span style="COLOR: #000000">!</span><span style="COLOR: #000000">result)<br />聽聽聽聽{聽<br />聽聽聽聽聽聽聽聽printf(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">Could聽not聽move聽file.聽error:%d</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">,GetLastError());<br />聽聽聽聽聽聽聽聽</span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000">聽</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;<br />聽聽聽聽}<br /></span></div><br />浣跨敤榪欑鏂規硶銆備綘蹇呴』鎻愪緵綾諱技GetLastError鐨勫彇閿欒鐨勬柟娉曪紝鑰屼笖浣犲繀欏諱繚璇佽繖涓嚱鏁版槸thread-safe鐨勶紝姣忎釜綰跨▼鑳界淮鎶よ嚜宸辯殑閿欒淇℃伅銆?br /><br /><strong>2. 榪斿洖澶т簬絳変簬0琛ㄧず鎴愬姛錛岃繑鍥?1琛ㄧず澶辮觸<br /></strong>socket api澶ч儴鍒嗘槸榪欐牱璁捐鐨?br /><br /><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><span style="COLOR: #0000ff">while</span><span style="COLOR: #000000">(聽bytesRecv聽</span><span style="COLOR: #000000">!=</span><span style="COLOR: #000000">聽SOCKET_ERROR聽)聽{<br />聽聽聽聽bytesRecv聽</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">聽recv(聽ConnectSocket,聽recvbuf,聽</span><span style="COLOR: #000000">32</span><span style="COLOR: #000000">,聽</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">聽);<br />聽聽聽聽</span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">聽(聽bytesRecv聽</span><span style="COLOR: #000000">==</span><span style="COLOR: #000000">聽</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">聽</span><span style="COLOR: #000000">||</span><span style="COLOR: #000000">聽bytesRecv聽</span><span style="COLOR: #000000">==</span><span style="COLOR: #000000">聽WSAECONNRESET聽)聽{<br />聽聽聽聽聽聽printf(聽</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">Connection聽Closed.\n</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">);<br />聽聽聽聽聽聽</span><span style="COLOR: #0000ff">break</span><span style="COLOR: #000000">;<br />聽聽聽聽}<br />聽聽聽聽printf(聽</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">Bytes聽Recv:聽%ld\n</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">,聽bytesRecv聽);<br />聽聽}<br /></span></div><br />榪欐牱鐨勫ソ澶勬槸榪斿洖鍊煎氨鍙互鐢ㄦ潵琛ㄧず鎴愬姛鍜岀姸鎬併傛瘮濡傝繖閲岀殑recv灝卞彲浠ヨ繑鍥炴敹鍒扮殑瀛楄妭鏁般備絾鏄綘榪樻槸瑕佹湁涓涓煡璇㈤敊璇殑API,like WSAGetLastError().<br /><br /><strong>3.榪斿洖0琛ㄧず鎴愬姛<br /></strong><br />COM鐨勬帴鍙eぇ閮ㄥ垎鏄繖鏍瘋璁$殑<br /><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(聽FAILED(lpdd</span><span style="COLOR: #000000">-></span><span style="COLOR: #000000">QueryInterface(IID_IDirectDraw7,聽(LPVOID聽</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">)聽</span><span style="COLOR: #000000">&</span><span style="COLOR: #000000">lpdd)))<br />聽聽聽聽{<br />聽聽聽聽聽聽聽聽聽聽</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">error聽handle聽and聽return</span><span style="COLOR: #008000"><br /></span><span style="COLOR: #000000">聽聽聽聽}<br /></span></div><br /><br /><br /><br /><br />鍏朵粬鐨勪竴浜涜冭檻<br /><br /><strong>1.濡備綍瀹氫箟閿欒鍊鹼紵<br /></strong>綆鍗曠殑涓鐐逛嬌鐢ㄥ畯榪炵畫瀹氫箟錛宭ike<br /><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><span style="COLOR: #0000ff">#define</span><span style="COLOR: #000000">聽E_NO_FILE聽1</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #0000ff">#define</span><span style="COLOR: #000000">聽E_BAD_FILE聽2</span></div>澶嶆潅鐨勪竴鐐瑰氨鍍廋OM錛屼弗鏍肩殑瀹氫箟姣忎竴浣嶇殑鎰忎箟<br />榪欑鎯呭喌涓嬩綘鍙互鎻愪緵涓涓畯鏉ュ垱寤洪敊璇唬鐮?like<br /><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><span style="COLOR: #0000ff">#define</span><span style="COLOR: #000000">聽MAKE_HRESULT(sev,fac,code)\</span><span style="COLOR: #000000"><br /><br />(聽(HRESULT)聽(((unsigned聽</span><span style="COLOR: #0000ff">long</span><span style="COLOR: #000000">)(sev)</span><span style="COLOR: #000000"><<</span><span style="COLOR: #000000">31</span><span style="COLOR: #000000">)聽</span><span style="COLOR: #000000">|</span><span style="COLOR: #000000">聽((unsigned聽</span><span style="COLOR: #0000ff">long</span><span style="COLOR: #000000">)(fac)</span><span style="COLOR: #000000"><<</span><span style="COLOR: #000000">16</span><span style="COLOR: #000000">)聽\<br /><br /></span><span style="COLOR: #000000">|</span><span style="COLOR: #000000">聽((unsigned聽</span><span style="COLOR: #0000ff">long</span><span style="COLOR: #000000">)(code)))聽)<br /></span></div><br /><strong>2.鍙互鎻愪緵涓涓畯鎴栬呭嚱鏁版潵甯姪鍒ゆ柇鏄惁鎴愬姛<br /></strong>姣斿COM鎻愪緵浜咶AILED瀹忔潵甯姪浣犲垽鏂瑿OM鐨勮繑鍥炲?br /><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><span style="COLOR: #0000ff">#define</span><span style="COLOR: #000000">聽FAILED(Status)聽聽聽聽聽((HRESULT)(Status)<0)</span><span style="COLOR: #000000"><br /></span></div><br /><strong>3.濡傛灉鍙湁閿欒鍜屾垚鍔熶袱涓繑鍥炲?鑰冭檻浣跨敤bool鏉ヨ繑鍥?br /></strong>榪欎釜閫傜敤浜嶤++,浼樼偣鏄剰涔夊緢娓呮櫚.榪斿洖 true灝辨槸鎴愬姛,false灝辨槸澶辮觸.<br /><br /><strong>4.瑕佷嬌鐢ㄥ紓甯告潵琛ㄧず閿欒鐨勭姸鎬佷箞?</strong><br />浣跨敤寮傚父鐨勫ソ澶勫氨鏄繑鍥炲艱鐪佸嚭鏉ヤ簡錛屽彲浠ヤ笉榪斿洖鎴栬呰繑鍥炲叾浠栦俊鎭紝榪樻湁鐩婁簬瀹氫箟閿欒綾誨瀷鍜岀畝鍖栫▼搴忔祦紼嬨傜己鐐瑰氨鏄疌++瀵瑰紓甯告敮鎸佽繕涓嶅濂?娌℃湁finally,姣忎竴瀹剁紪璇戝櫒鏀寔涔熶笉涓鏍?瀹炵幇鍙兘澶т笉鍚?<br /><img src ="http://www.shnenglu.com/sandy/aggbug/6252.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/sandy/" target="_blank">灝忔槑</a> 2006-04-25 16:55 <a href="http://www.shnenglu.com/sandy/archive/2006/04/25/6252.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>Is it a vc6 bug?http://www.shnenglu.com/sandy/archive/2006/04/24/6195.html灝忔槑灝忔槑Mon, 24 Apr 2006 10:08:00 GMThttp://www.shnenglu.com/sandy/archive/2006/04/24/6195.htmlhttp://www.shnenglu.com/sandy/comments/6195.htmlhttp://www.shnenglu.com/sandy/archive/2006/04/24/6195.html#Feedback21http://www.shnenglu.com/sandy/comments/commentRss/6195.htmlhttp://www.shnenglu.com/sandy/services/trackbacks/6195.html #include聽 < stdio.h >

int 聽main()
{
聽聽聽聽
int 聽a = 10 ,b = 20 ;

聽聽聽聽a
= (a + b) - (b = a);

聽聽聽聽printf(
" a=%d,b=%d\n " ,a,b);
聽聽聽聽
聽聽聽聽
return 0 ;
}

寰堢畝鍗曪紝浜ゆ崲a鍜宐鐨勫?br />
鍦╠ebug妯″紡涓嬶紝杈撳嚭
a=20,b=10

鍦╮elease妯″紡涓嬶紝杈撳嚭
a=10,b=10

I think there is a bug in release version.

灝忔槑 2006-04-24 18:08 鍙戣〃璇勮
]]>
C++浠g爜闈欐佸垎鏋愬伐鍏?Prefasthttp://www.shnenglu.com/sandy/archive/2006/03/28/4689.html灝忔槑灝忔槑Tue, 28 Mar 2006 05:59:00 GMThttp://www.shnenglu.com/sandy/archive/2006/03/28/4689.htmlhttp://www.shnenglu.com/sandy/comments/4689.htmlhttp://www.shnenglu.com/sandy/archive/2006/03/28/4689.html#Feedback7http://www.shnenglu.com/sandy/comments/commentRss/4689.htmlhttp://www.shnenglu.com/sandy/services/trackbacks/4689.html 1. 浠涔堟槸Prefast

Prefast鏄竴縐嶄唬鐮佸垎鏋愬伐鍏鳳紝瀹冭兘澶熷府鍔╀綘鎵懼埌緙栬瘧鍣ㄤ笉鑳芥壘鍒扮殑閿欒鎴栬呯己闄楓侾refast棣栨琚井杞泦鎴愬埌Visual Studio 2005 Team Suite涓幓錛屼嬌鐢ㄨ搗鏉ラ潪甯告柟渚褲?br />
2.鎬庝箞浣跨敤Prefast
鍦╲s2005 Team Suite涓紝浣跨敤Prefast闈炲父綆鍗曘備慨鏀逛綘鐨勫伐紼嬪睘鎬э紝璁劇疆Enable Code Analysis For C/C++涓篩es.

prefast1.jpg

鏁堟灉:
prefast2.jpg

娉ㄦ剰鍒版湁鍙兘閿欒鐨勫湴鏂逛互嫻呯伆鑹叉樉紺哄湪緙栬緫鍣ㄤ腑浜嗐?/p>

3.Prefast鑳藉府浣犳壘鍒板摢浜涢敊璇?br />
1)娌℃湁鍒濆鍖?/p>

// no聽initial
void 聽defect1()
{
聽聽聽聽聽聽聽聽
int 聽a;
聽聽聽聽聽聽聽聽
int 聽b;

聽聽聽聽聽聽聽聽b聽
= 聽a;
}

浼氭姤: d:\test\testcode\testcode.cpp(18) : warning C6001: Using uninitialized memory 'a': Lines: 15, 16, 18

2)絀烘寚閽堝彇鍊?br />

// one聽path聽dereference聽NULL
void 聽defect4( int 聽b,聽 int 聽c)
{
聽聽聽聽聽聽聽聽
int * p聽 = 聽NULL;
聽聽聽聽聽聽聽聽
int 聽a聽 = 1 ;

聽聽聽聽聽聽聽聽
if 聽(b聽 == 1 )聽{
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽
if 聽(c聽 == 1 )聽{
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽p聽
= & a;
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽}
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽
else 聽{
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽}
聽聽聽聽聽聽聽聽}
聽聽聽聽聽聽聽聽
else 聽{
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽
if 聽(c聽 == 1 )聽{

聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽}
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽
else 聽{
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽p聽
= & a;
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽}
聽聽聽聽聽聽聽聽}

聽聽聽聽聽聽聽聽
* p;

聽聽聽聽聽聽聽聽
return ;
}聽聽聽聽

浼氭姤:d:\test\testcode\testcode.cpp(65) : warning C6011: Dereferencing NULL pointer 'p': Lines: 45, 46, 48, 57, 65

3)鍙兘閿欒鐨勮繍綆楃浼樺厛綰?br />

void 聽defect5()
{
聽聽聽聽聽聽聽聽
int 聽a聽 = 1 ;
聽聽聽聽聽聽聽聽
int 聽b聽 = 1 ;
聽聽聽聽聽聽聽聽
int 聽c聽 = 1 ;

聽聽聽聽聽聽聽聽
if 聽(a聽 & 聽b聽 == 聽c)
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽
return ;
}

浼氭姤: d:\test\testcode\testcode.cpp(76) : warning C6281: Incorrect order of operations: relational operators have higher precedence than bitwise operators

4)鍙兘鐨刡uffer overrun

void 聽defect8()
{
聽聽聽聽聽聽聽聽
char 聽buf[ 100 ];
聽聽聽聽聽聽聽聽
char 聽buf2[ 200 ];
聽聽聽聽聽聽聽聽
int 聽i聽 = 100 ;

聽聽聽聽聽聽聽聽sprintf(buf,聽
" hello聽world聽%d " ,聽i);
聽聽聽聽聽聽聽聽strcpy(buf,聽buf2);
}

浼氭姤: d:\test\testcode\testcode.cpp(133) : warning C6202: Buffer overrun for 'buf', which is possibly stack allocated, in call to 'strcpy': length '200' exceeds buffer size '100'

5)鍙兘鐨勬棤絀峰驚鐜?br />

// infinite聽loop
void 聽defect14()
{
聽聽聽聽聽聽聽聽signed聽
char 聽i;

聽聽聽聽聽聽聽聽
for 聽(i聽 = 100 ;聽i聽 >= 0 ;聽i ++ )聽{
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽;聽
聽聽聽聽聽聽聽聽}
}

浼氭姤: d:\test\testcode\testcode.cpp(198) : warning C6292: Ill-defined for-loop: counts up from maximum

6)鏍煎紡瀛楃涓查敊璇?br />

// Format聽string聽mismatch
void 聽defect21()
{
聽聽聽聽聽聽聽聽
char 聽buff[ 5 ];
聽聽聽聽聽聽聽聽sprintf(buff,聽
" %s聽%s " ,聽 " a " );
}

浼氭姤: d:\test\testcode\testcode.cpp(277) : warning C6063: Missing string argument to 'sprintf' that corresponds to conversion specifier '2'

7)瀹夊叏闂

void 聽defect27()
{
聽聽聽聽聽聽聽聽CreateProcess(NULL,
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽
" c:\\program聽files\\Project.exe聽arg1 " ,聽 // correct聽"\"c:\\program聽files\\Project.exe\"聽arg1",
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽NULL,
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽NULL,
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽
false ,
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽
0 ,
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽NULL,
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽NULL,
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽NULL,
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽NULL);聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽
}

浼氭姤: d:\test\testcode\testcode.cpp(327) : warning C6277: NULL application name with an unquoted path in call to 'CreateProcessA': results in a security vulnerability if the path contains spaces

8)=鍜?=璇敤

void 聽defect32()
{
聽聽聽聽聽聽聽聽
int 聽a聽 = 1 ;

聽聽聽聽聽聽聽聽
if 聽(a聽 = 2 )
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽
return ;
}

浼氭姤: d:\test\testcode\testcode.cpp(405) : warning C6282: Incorrect operator: assignment of constant in Boolean context. Consider using '==' instead

9)閫昏緫榪愮畻闂

// always聽false
void 聽defect45()
{
聽聽聽聽聽聽聽聽
int 聽x;

聽聽聽聽聽聽聽聽
if 聽( 0 && 聽x ++ )聽{
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽;
聽聽聽聽聽聽聽聽}
}

浼氭姤: d:\test\testcode\testcode.cpp(564) : warning C6237: (<zero> && <expression>) is always zero. <expression> is never evaluated and might have side effects

10)鍏朵粬







灝忔槑 2006-03-28 13:59 鍙戣〃璇勮
]]>
C++璺ㄥ鉤鍙板紑鍙戞柟娉?宸ュ叿http://www.shnenglu.com/sandy/archive/2006/03/24/4544.html灝忔槑灝忔槑Fri, 24 Mar 2006 08:45:00 GMThttp://www.shnenglu.com/sandy/archive/2006/03/24/4544.htmlhttp://www.shnenglu.com/sandy/comments/4544.htmlhttp://www.shnenglu.com/sandy/archive/2006/03/24/4544.html#Feedback26http://www.shnenglu.com/sandy/comments/commentRss/4544.htmlhttp://www.shnenglu.com/sandy/services/trackbacks/4544.html  闃呰鍏ㄦ枃

灝忔槑 2006-03-24 16:45 鍙戣〃璇勮
]]>
鍐嶈皥浠巚c6榪佺Щ鍒皏s2005http://www.shnenglu.com/sandy/archive/2006/03/13/4081.html灝忔槑灝忔槑Mon, 13 Mar 2006 03:03:00 GMThttp://www.shnenglu.com/sandy/archive/2006/03/13/4081.htmlhttp://www.shnenglu.com/sandy/comments/4081.htmlhttp://www.shnenglu.com/sandy/archive/2006/03/13/4081.html#Feedback12http://www.shnenglu.com/sandy/comments/commentRss/4081.htmlhttp://www.shnenglu.com/sandy/services/trackbacks/4081.html 

   浣滀負C++緙栬瘧鍣紝浠巚c6鍒皏c8鏈澶х殑璋冩暣灝辨槸瀵笴++鏍囧噯鐨勬敮鎸佹洿濂戒簡銆?BR>   鎴戝彂鐜扮殑鍑犵偣涓嶅悓銆?BR>
a. For 寰幆鐨勫0鏄?BR>
      Vc6: for(int i<0;i<100;++i){}; j = i;   (ok)

Vc8: for(int i<0;i<100;++i){}; j = i;   (illegal)

      int i; for(i<0;i<100;++i){}; j = i;   (ok)

Vc8涓殑for寰幆涓彉閲忕殑鏈夋晥鏈熶粎浠呭湪for 寰幆鐨勫紑濮嬩笌緇撴潫鏈熼棿鏈夋晥銆?BR>
b.string瀹炵幇
   

Vc6: string s; char *p = s.begin(); (ok)

Vc8: string s; char *p = s.begin(); (illegal)

     string s; char *p = const_cast<char *>(s.c_str()); (ok)

鍦╲c6涓?string::iterator琚畾涔変負char *,浣嗘槸vc8涓笉鏄?BR>
c.鏇翠弗鏍肩殑typename澹版槑鐨勯渶瑕?BR>

Vc6:

template<class T>

class Test

{

public:

typedef map<T,T> mymap;

      mymap::iterator mymap_iter;

}; (ok)

Vc8:

template<class T>

class Test

{

public:

      typedef map<T,T> mymap;

      mymap::iterator mymap_iter;

};     (illegal)

typename mymap::iterator mymap_iter;(ok)

vc8鏇村姞涓ユ牸鐨勮姹傜▼搴忓憳鍦ㄧ被鍨嬪墠闈㈠姞涓妕ypename浠ラ伩鍏嶆涔?BR>
d.涓嶅厑璁擱粯璁ょ殑int綾誨瀷

Vc6: fun() { return 0;} (ok)

Vc8: fun() { return 0;} (illegal)

int fun() { return 0;} (ok)

vc8涓嶆敮鎸侀粯璁よ繑鍥瀒nt綾誨瀷

e.typedef蹇呴』鏄痯ublic鎵嶈兘琚鐣岃闂埌

Vc6:

Class Test

{

      typedef int iterator;

};

Test::iterator i; (ok)

Vc8:

Class Test

{

      typedef int iterator;

};

Test::iterator i; (illegal)

 

Class Test

{

public:

      typedef int iterator;

};

Test::iterator i; (ok)

闄勫綍錛氫竴浜涜祫婧愶紙From msdn)

Overviews:

Moving from 6.0 to 7.1:

Moving from 7.1 to 8.0:



灝忔槑 2006-03-13 11:03 鍙戣〃璇勮
]]>
Java涓渶鍊煎緱C++鍊熼壌鐨勭壒鎬http://www.shnenglu.com/sandy/archive/2006/01/25/3018.html灝忔槑灝忔槑Wed, 25 Jan 2006 03:40:00 GMThttp://www.shnenglu.com/sandy/archive/2006/01/25/3018.htmlhttp://www.shnenglu.com/sandy/comments/3018.htmlhttp://www.shnenglu.com/sandy/archive/2006/01/25/3018.html#Feedback16http://www.shnenglu.com/sandy/comments/commentRss/3018.htmlhttp://www.shnenglu.com/sandy/services/trackbacks/3018.html闃呰鍏ㄦ枃

灝忔槑 2006-01-25 11:40 鍙戣〃璇勮
]]>
浠庡叏灞鍙橀噺鍒癐OC妯″紡http://www.shnenglu.com/sandy/archive/2006/01/20/2941.html灝忔槑灝忔槑Fri, 20 Jan 2006 09:23:00 GMThttp://www.shnenglu.com/sandy/archive/2006/01/20/2941.htmlhttp://www.shnenglu.com/sandy/comments/2941.htmlhttp://www.shnenglu.com/sandy/archive/2006/01/20/2941.html#Feedback7http://www.shnenglu.com/sandy/comments/commentRss/2941.htmlhttp://www.shnenglu.com/sandy/services/trackbacks/2941.html
涓轟粈涔堣鍏ㄥ眬鍙橀噺?
List 1
int main()
{
int s1,s2,s3;
fun1(s1);
fun2(s1,s2);
fun3(s1,s2,s3);
return 0;
}
涓婇潰鐨剆1,s2,s3濡傛灉鏀規垚鍏ㄥ眬鍙橀噺錛屽垯鍙樹負
List 2
int s1,s2,s3;

int main()
{
    fun1();
    fun2();
    fun3();
}
浼間箮綆媧佷簡涓浜涳紝鑰屼笖娌℃湁浜嗕紶閫掑弬鏁扮殑寮閿銆備絾鏄己鐐逛篃鏄緢鏄庢樉鐨勶紝甯︿簡涓変釜鍑芥暟涔嬮棿鐨勮﹀悎銆?BR>
鏃㈢劧鎴戜滑璁よ瘑鍒板叏灞鍙橀噺鐨勯棶棰橈紝鎬庝箞鏀硅繘鍛紵
浠g爜1涓敱浜庢湁涓変釜鍙橀噺錛屽鏋滄湁鏇村鐨勶紝灝辨洿楹葷儲錛屾垜浠彲浠ヨ繖鏍鋒敼榪?BR>List 3
typedef struct statusTag
{
    
int s1,s2,s3;
}Status;

int main()
{
    Status s;
    fun1(
&s);
    fun2(
&s);
    fun3(
&s);
    
return 0;
}
榪欑鎶宸т綘鍙互鍦╨ua涓湅鍒幫紝鐪媗ua鐨勪嬌鐢ㄤ唬鐮?BR>List4
#include "lua.h"
#include 
"lauxlib.h"
#include 
"lualib.h"

int main(int argc, char *argv[])
{
    lua_State 
*= lua_open();
    
const char *buf = "var = 100";
    
int var ;
    luaopen_base(L);
    luaopen_io(L);
    lua_dostring(L, buf);
    lua_getglobal(L, 
"var");
    var 
= lua_tonumber(L, -1);
    lua_close(L);
    
    
return 0;
璇鋒敞鎰忓埌榪欓噷鐨刲ua_open鏂規硶錛岃繖鍏跺疄鏄竴縐嶅垱寤鴻嚜宸辯殑宸ュ巶鏂規硶銆備笉浣跨敤鍏ㄥ眬鍙橀噺鐨勫ソ澶勫氨鏄紝鎴戜滑淇濈暀浜嗗彲浠ュ垱寤哄涓璞$殑鑷敱銆?BR>
鏃朵唬鍦ㄥ彂灞曪紝榪涘叆C++鏃朵唬錛屼絾鏄叏灞鍙橀噺浠嶇劧鏈変漢鍦ㄧ敤錛屽瓨鍦ㄥ氨鏄悎鐞嗙殑銆侴OF鎻愬嚭涓縐嶈璁℃ā寮忓彨Singleton鐨勬ā寮忥紝鍏舵牳蹇冩濇兂灝辨槸涓嶈鍏ㄥ眬鍙橀噺婕傛誕鍦ㄧ┖涓紝鎶婂畠鏀懼叆class涓紝鎴愪負琛e啝妤氭鐨凜++鍏皯銆傝憲鍚嶇殑Meyer Singleton鍍忚繖鏍?BR>List 5
class Status
{
private:
    Status(){};
public:
    
static Status& getInstance()
    {
           
static Status s;
           
return s;
    }
};

class User
{
    
void fun()
    {
        Status 
&= Status::Instance();
        
//. . .use s
    }
};

涓鍒囦技涔庡緢瀹岀編錛屼嬌鐢╬rivate鏉ラ槻姝lient 鍒涘緩瀹冿紝淇濊瘉浜嗗璞$殑鍞竴鎬?娉ㄦ剰:Meyer singleton騫朵笉鍏鋒湁澶氱嚎紼嬪畨鍏紝鍙兘瀵艱嚧澶氭鍒濆鍖栧璞?

浣嗘槸闅忕潃 閽堝鎺ュ彛緙栫▼鍜屽崟鍏冩祴璇曡秺鏉ヨ秺嫻佽錛宻ingleton甯︽潵鐨勫鍗曞厓嫻嬭瘯涓嶅弸濂界殑鐗圭偣鏃ョ泭浣撶幇錛屽叏灞鍙橀噺涓嶈兘寰堝ソ鐨勮mock錛屾墍浠ラ毦浜庢祴璇曘?BR>
榪欐椂鍊欐墍璋撶殑IOC鎬濇兂(Inversion of Control錛屽嵆鍙嶈漿妯″紡)鍑烘潵浜嗭紝綆鍗曠殑鏉ヨ錛屽氨鏄氳繃鏋勯犲嚱鏁版垨鑰卻et鏂規硶瀹炵幇娉ㄥ叆

List6 - 鏋勯犲嚱鏁版敞鍏?BR>
class Status{};

class User
{
   
public:
      User(Status 
*s):m_ps(s){};
      
void fun()
      {
           Status 
*= m_ps;
      }
   
private:
      Status 
*m_ps;
}

List7 - Set 娉ㄥ叆
class Status{};

class User
{
   
public:
      User(){}
      
      
void setStaus(Status *s)
      {
           m_ps 
= s;
      }
      
      
void fun()
      {
           Status 
*= m_ps;
      }
   
private:
      Status 
*m_ps;
}

浣跨敤IOC鐨勫ソ澶勬槸甯︽潵浜嗘洿寮哄ぇ鐨勭伒媧繪э紝浣嗘槸甯︽潵鐨勯棶棰樺氨鏄皟鐢ㄨ呴夯鐑︿簡(澶╀笅娌℃湁鍏嶈垂鐨勫崍槨愰樋錛?BR>
List8
int main()
{
   Status s;
   User u;
   u.setStatus(
&s);
   u.fun();
   
return 0;
}

濂藉儚涓鍒囧張榪旀湸褰掔湡錛屼技涔庡茍娌℃湁甯︽潵浠涔堢畝鍗曘傛湁鐨勬椂鍊欑畝鍗曞拰鐏墊椿鎬у氨鏄瀵瑰ご銆?BR>
涓轟簡綆鍖栫敤鎴瘋繘琛屾墜宸ユ敞鍏ワ紝IOC瀹瑰櫒鍑虹幇錛屽湪Java涓栫晫閲岄潰錛屾渶钁楀悕鐨勮帿榪囦簬Spring浜?IOC瀹瑰櫒灝卞儚涓涓法澶х殑鍒涘緩宸ュ巶錛屽ス鍙互浣跨敤xml鏉ラ厤緗繖浜涳紝榪欑湡鐨勬槸涓鍦洪潻鍛姐?BR>
<beans>
    
<bean id="status" class="Status">
    
</bean>

    
<bean id="user" class="User">
        
<property name="status"><ref bean="status"/></property>
    
</bean>
</beans>
Spring灝辨槸榪欐牱鎶婃敞鍏ョ殑宸ヤ綔縐誨埌閰嶇疆鏂囦歡涓幓錛屾彁渚涗簡寮哄ぇ鐨勭伒媧繪у拰鍙厤緗?BR>

浣嗘槸鐢變簬c/c++ 涓嶅叿澶囩殑java閭d箞澶氳繍琛屾湡鐨勭被鍨嬭瘑鍒拰鍙嶅皠鐨勫姛鑳斤紝鎵浠ユ垜鐩墠榪樻病鏈夊彂鐜版湁鍦–++涓嬌鐢ㄧ殑IOC瀹瑰櫒錛屽鏋滀綘鐭ラ亾錛岃鍛婅瘔鎴?BR>
閭d箞濡傛灉鏄疌++鎬庝箞鏉ヤ嬌娉ㄥ叆鍙樺緱綆鍗曚竴鐐瑰憿錛屽彲浠ヤ嬌鐢ㄥ伐鍘傛柟娉曚簡

List9
User * createUser(Status &s,Status2 &s2)
{
   User 
*user = new User();
   user
->setStatus(s);
   user
->setStatus2(s2);
   
return user;
}


鎬葷粨:
鍏跺疄杞歡鐨勮璁℃牴鏈氨娌℃湁鎵璋撶殑榛勯噾娉曞垯錛屾病鏈夊厤璐圭殑鍗堥錛屼綘鍦ㄨ幏寰楁洿寮哄ぇ鐨勭伒媧繪э紝寰寰閮藉緱鍒板鏉傛х殑闄勫姞鏁堟灉銆傚鏋滀綘灝辨槸鍐欎竴涓嚜宸辯帺鐨勫皬娓告垙錛宱k,浣犲氨鏄敤鍏ㄥ眬鍙橀噺銆傚鏋滀綘瑕佽璁″簽澶х殑Office,閭d綘灝辨病鏈夊姙娉曟妸浠g爜鍐欑殑寰堢畝鍗曪紝鍥犱負浣犺鑰冭檻鐨勪笢瑗垮浜嗭紝鍙淮鎶ゆэ紝鍙祴璇曟с?img src ="http://www.shnenglu.com/sandy/aggbug/2941.html" width = "1" height = "1" />

灝忔槑 2006-01-20 17:23 鍙戣〃璇勮
]]>
C++緙栬瘧鏈烠onstraints璁捐http://www.shnenglu.com/sandy/archive/2006/01/17/2830.html灝忔槑灝忔槑Tue, 17 Jan 2006 06:12:00 GMThttp://www.shnenglu.com/sandy/archive/2006/01/17/2830.htmlhttp://www.shnenglu.com/sandy/comments/2830.htmlhttp://www.shnenglu.com/sandy/archive/2006/01/17/2830.html#Feedback0http://www.shnenglu.com/sandy/comments/commentRss/2830.htmlhttp://www.shnenglu.com/sandy/services/trackbacks/2830.html
甯哥敤鐨勮鍒?
1.澶у皬涓?鐨勬暟緇勫湪緙栬瘧鏈熶細鎶ラ敊
template<typename T1,typename T2>
void check_size()
{
     
int dmp[sizeof(T1)==sizeof(T2)];
}

姣斿
check_size<int,long>();//ok
check_size<int,char>();//compile error:cannot allocate an array of constant size 0

2.涓嶅悓綾誨瀷鐨勬寚閽堥渶瑕佸己鍒惰漿鎹?/STRONG>
浠ユ鍙互鐢ㄦ潵鍒ゆ柇涓や釜瀵硅薄鏄惁鏈夌戶鎵垮叧緋?BR>
template<typename T1,typename T2>
void is_derived(T1 *pd =0 ,T2 *pb=0)
{
    pb 
= pd;
}
姣斿:
is_derived<int,char>()  //compile failed

3.union鐨勬垚鍛樹笉鑳芥槸闈濸OD
union Test
{
    std::string s; //illegal
};
榪欎竴鐐瑰彲浠ョ敤鏉ユ祴璇曚竴涓被鍨嬫槸鍚︽槸POD
template<typename T>
void check_pod()
{
    union {
        T data;
    };
};
姣斿:
check_pod<int>();//ok
check_pod<std::string>();//failed


甯哥敤鐨勬妧宸?

1.鍒╃敤妯℃澘鐗瑰寲
Loki閲岄潰鐨勪緥瀛?BR>
namespace Loki
{
    template
<int> struct CompileTimeError;
    template
<> struct CompileTimeError<true> {};
}

#define LOKI_STATIC_CHECK(expr, msg) \
    { Loki::CompileTimeError
<((expr) != 0)> ERROR_##msg; (void)ERROR_##msg; } 
鍒╃敤鐗瑰寲鏉ュ畾鍒墮敊璇俊鎭?BR>
2.鍒╃敤絀哄嚱鏁版潵瀹炵幇0寮閿
緙栬瘧鍣ㄥ彲鑳藉皢絀哄嚱鏁頒紭鍖栨帀

3.鍒╃敤enum鏃犲紑閿鐨勫彇寰楃紪璇戞湡鐨勬墍寰楀埌鐨勬暣鏁板?BR>Loki閲岄潰鐨勪緥瀛?
template <class TList> struct Length;
        template 
<> struct Length<NullType>
        {
            
enum { value = 0 };
        };
        
        template 
<class T, class U>
        
struct Length< Typelist<T, U> >
        {
            
enum { value = 1 + Length<U>::value };
        };


灝忔槑 2006-01-17 14:12 鍙戣〃璇勮
]]>
浠涔堟墠鏄綰跨▼瀹夊叏鐨?/title><link>http://www.shnenglu.com/sandy/archive/2006/01/12/2690.html</link><dc:creator>灝忔槑</dc:creator><author>灝忔槑</author><pubDate>Thu, 12 Jan 2006 09:45:00 GMT</pubDate><guid>http://www.shnenglu.com/sandy/archive/2006/01/12/2690.html</guid><wfw:comment>http://www.shnenglu.com/sandy/comments/2690.html</wfw:comment><comments>http://www.shnenglu.com/sandy/archive/2006/01/12/2690.html#Feedback</comments><slash:comments>19</slash:comments><wfw:commentRss>http://www.shnenglu.com/sandy/comments/commentRss/2690.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/sandy/services/trackbacks/2690.html</trackback:ping><description><![CDATA[瀵逛簬澶氱嚎紼嬬紪紼嬶紝寰堝浜烘蹇典笉娓咃紝鍐欎唬鐮佺殑鏃跺欒涔堟槸澶勫鍔犻攣錛屽獎鍝嶆ц兘涓嶈錛岃繕瀹規槗鑾悕鍏跺鐨勬閿侊紝榪樻湁浜哄澶氱嚎紼嬫暚鑰岃繙涔嬨?BR><BR>鎵浠ュ涔犲綰跨▼緙栫▼鏈閲嶈鐨勪笉鏄涔燗PI,鑰屾槸鐞嗚В浠涔堟墠鏄綰跨▼瀹夊叏鐨勪唬鐮?BR><BR>浠庝緥瀛愯璧?BR><BR> <DIV style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><SPAN style="COLOR: #000000">#include </SPAN><SPAN style="COLOR: #000000"><</SPAN><SPAN style="COLOR: #000000">windows.h</SPAN><SPAN style="COLOR: #000000">></SPAN><SPAN style="COLOR: #000000"><BR>#include </SPAN><SPAN style="COLOR: #000000"><</SPAN><SPAN style="COLOR: #000000">process.h</SPAN><SPAN style="COLOR: #000000">></SPAN><SPAN style="COLOR: #000000"><BR><BR></SPAN><SPAN style="COLOR: #0000ff">long</SPAN><SPAN style="COLOR: #000000"> global1 </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">;<BR></SPAN><SPAN style="COLOR: #0000ff">volatile</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">long</SPAN><SPAN style="COLOR: #000000"> global2 </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">;<BR><BR></SPAN><SPAN style="COLOR: #0000ff">class</SPAN><SPAN style="COLOR: #000000"> MyClass<BR>{<BR></SPAN><SPAN style="COLOR: #0000ff">public</SPAN><SPAN style="COLOR: #000000">:<BR>    MyClass() : m(</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">)<BR>    {<BR>        </SPAN><SPAN style="COLOR: #000000">++</SPAN><SPAN style="COLOR: #000000">m;<BR>    }<BR><BR>    </SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000"> fun(</SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000"> v)<BR>    {<BR>        </SPAN><SPAN style="COLOR: #0000ff">return</SPAN><SPAN style="COLOR: #000000"> m</SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000">v; </SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">-----------9</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #000000">    }<BR><BR>    </SPAN><SPAN style="COLOR: #0000ff">void</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">set</SPAN><SPAN style="COLOR: #000000">(</SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000"> v)<BR>    {<BR>        m </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> v;   </SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">-------------10</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #000000">    }<BR>    </SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000"> m;<BR>};<BR><BR>MyClass global_object; </SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">-------------8</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #000000"><BR>unsigned </SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000"> __stdcall thread_fun1(</SPAN><SPAN style="COLOR: #0000ff">void</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">*</SPAN><SPAN style="COLOR: #000000">param)<BR>{<BR>    </SPAN><SPAN style="COLOR: #0000ff">static</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000"> static2 </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">;<BR>    </SPAN><SPAN style="COLOR: #0000ff">static</SPAN><SPAN style="COLOR: #000000"> MyClass static_object; </SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">--------6</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #000000">    </SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000"> local1 </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">;<BR>    <BR>    </SPAN><SPAN style="COLOR: #000000">++</SPAN><SPAN style="COLOR: #000000">local1;     </SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">-------1</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #000000">    </SPAN><SPAN style="COLOR: #000000">++</SPAN><SPAN style="COLOR: #000000">static2;    </SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">-------2</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #000000">    </SPAN><SPAN style="COLOR: #000000">++</SPAN><SPAN style="COLOR: #000000">global1;    </SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">-------3</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #000000">    </SPAN><SPAN style="COLOR: #000000">++</SPAN><SPAN style="COLOR: #000000">global2;    </SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">-------4</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #000000">    InterlockedIncrement(</SPAN><SPAN style="COLOR: #000000">&</SPAN><SPAN style="COLOR: #000000">global1); </SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">--------5</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #000000"><BR>    local1 </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> global_object.fun(local1); </SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">----------7</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #000000"><BR>    global_object.</SPAN><SPAN style="COLOR: #0000ff">set</SPAN><SPAN style="COLOR: #000000">(local1); </SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">---------------11</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #000000"><BR>    </SPAN><SPAN style="COLOR: #0000ff">return</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">;<BR>}<BR><BR><BR>unsigned </SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000"> __stdcall thread_fun2(</SPAN><SPAN style="COLOR: #0000ff">void</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">*</SPAN><SPAN style="COLOR: #000000">param)<BR>{<BR>    </SPAN><SPAN style="COLOR: #000000">++</SPAN><SPAN style="COLOR: #000000">global1;    </SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">-------3</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #000000">    </SPAN><SPAN style="COLOR: #000000">++</SPAN><SPAN style="COLOR: #000000">global2;    </SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">-------4</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #000000">    InterlockedIncrement(</SPAN><SPAN style="COLOR: #000000">&</SPAN><SPAN style="COLOR: #000000">global1); </SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">--------5</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #000000"><BR>    global_object.</SPAN><SPAN style="COLOR: #0000ff">set</SPAN><SPAN style="COLOR: #000000">(</SPAN><SPAN style="COLOR: #000000">1</SPAN><SPAN style="COLOR: #000000">); </SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">-----------11</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #000000">    </SPAN><SPAN style="COLOR: #0000ff">return</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">;<BR>}<BR><BR><BR></SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000"> main()<BR>{<BR>    HANDLE thread1 </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> (HANDLE)_beginthreadex(</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">,</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">,</SPAN><SPAN style="COLOR: #000000">&</SPAN><SPAN style="COLOR: #000000">thread_fun1,</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">,</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">,</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">); </SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">thread 1</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #000000">    HANDLE thread2 </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> (HANDLE)_beginthreadex(</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">,</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">,</SPAN><SPAN style="COLOR: #000000">&</SPAN><SPAN style="COLOR: #000000">thread_fun1,</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">,</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">,</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">); </SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">thread 2</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #000000">    HANDLE thread3 </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> (HANDLE)_beginthreadex(</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">,</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">,</SPAN><SPAN style="COLOR: #000000">&</SPAN><SPAN style="COLOR: #000000">thread_fun2,</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">,</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">,</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">); </SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">thread 3</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #000000">    <BR>    WaitForSingleObject(thread1,INFINITE);<BR>    WaitForSingleObject(thread2,INFINITE);<BR>    WaitForSingleObject(thread3,INFINITE);<BR>    <BR>    </SPAN><SPAN style="COLOR: #0000ff">return</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">;<BR>}<BR><BR></SPAN></DIV><BR><BR><STRONG>1.灞閮ㄥ彉閲忓眬閮ㄤ嬌鐢ㄦ槸瀹夊叏鐨?/STRONG><BR>涓轟粈涔?鍥犱負姣忎釜thread 閮芥湁鑷繁鐨勮繍琛屽爢鏍堬紝鑰屽眬閮ㄥ彉閲忔槸鐢熷瓨鍦ㄥ爢鏍堜腑,澶у涓嶅共鎵般?BR>鎵浠ヤ唬鐮?<BR>int local1;<BR>++local1;<BR>鏄畨鍏ㄧ殑<BR><BR><STRONG>2.鍏ㄥ眬鍘熺敓鍙橀噺澶氱嚎紼嬭鍐欐槸涓嶅畨鍏ㄧ殑<BR></STRONG>鍏ㄥ眬鍙橀噺鏄湪鍫?heap)涓?BR>long global1 = 0;<BR>++global2;<BR>++榪欎釜鎿嶄綔鍏跺疄鍒嗕負涓ら儴錛屼竴涓槸璇伙紝鍙﹀涓涓槸鍐?BR> mov         ecx,global<BR> add         ecx,1<BR> mov         global,ecx<BR>鎵浠ヤ唬鐮?澶勬槸涓嶅畨鍏ㄧ殑<BR><BR><STRONG>3.鍑芥暟闈欐佸彉閲忓綰跨▼璇誨啓涔熸槸涓嶅畨鍏ㄧ殑<BR></STRONG>閬撶悊鍚?<BR>鎵浠ヤ唬鐮?澶勪篃鏄笉瀹夊叏鐨?BR><BR><STRONG>4.volatile鑳戒繚璇佸叏灞鏁村艦鍙橀噺鏄綰跨▼瀹夊叏鐨勪箞</STRONG><BR>涓嶈兘銆?BR>volatile浠呬粎鏄憡璇玞ompiler涓嶈瀵硅繖涓彉閲忎綔浼樺寲錛屾瘡嬈¢兘瑕佷粠memory鍙栨暟鍊鹼紝鑰屼笉鏄粠register<BR>鎵浠ヤ唬鐮?涔熶笉鏄畨鍏?BR><BR><STRONG>5.InterlockedIncrement淇濊瘉鏁村瀷鍙橀噺鑷鐨勫師瀛愭?/STRONG><BR>鎵浠ヤ唬鐮?鏄畨鍏ㄧ殑<BR><BR><STRONG>6.function static object鐨勫垵濮嬪寲鏄綰跨▼瀹夊叏鐨勪箞</STRONG><BR>涓嶆槸銆?BR>钁楀悕鐨凪eyer Singleton鍏跺疄涓嶆槸綰跨▼瀹夊叏鐨?BR>Object & getInstance()<BR>{ <BR>     static Object o;<BR>     return o;<BR>}<BR>鍙兘浼氶犳垚澶氭鍒濆鍖栧璞?BR>鎵浠ヤ唬鐮?澶勬槸涓嶅畨鍏ㄧ殑<BR><BR><STRONG>7.鍦?2鏈哄櫒涓婏紝4瀛楄妭鏁村艦涓嬈ssign鏄師瀛愮殑</STRONG><BR>姣斿<BR>i =10; //thread1<BR>i=4; //thread2<BR>涓嶄細瀵艱嚧i鐨勫煎浜庢湭鐭ョ姸鎬?瑕佷箞鏄?0瑕佷箞鏄?<BR><BR>鍏跺畠鐨勫ぇ瀹惰嚜宸卞幓浣撲細銆?BR><BR>鍐欏ソ澶氱嚎紼嬪畨鍏ㄧ殑娉曞疂灝辨槸灝佽錛屼嬌鏁版嵁鏈変繚鎶ょ殑琚闂埌<BR>瀹夊叏鎬э細<BR>灞閮ㄥ彉閲?gt;鎴愬憳鍙橀噺>鍏ㄥ眬鍙橀噺<img src ="http://www.shnenglu.com/sandy/aggbug/2690.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/sandy/" target="_blank">灝忔槑</a> 2006-01-12 17:45 <a href="http://www.shnenglu.com/sandy/archive/2006/01/12/2690.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>璇″紓鐨凜http://www.shnenglu.com/sandy/archive/2006/01/09/2504.html灝忔槑灝忔槑Mon, 09 Jan 2006 06:04:00 GMThttp://www.shnenglu.com/sandy/archive/2006/01/09/2504.htmlhttp://www.shnenglu.com/sandy/comments/2504.htmlhttp://www.shnenglu.com/sandy/archive/2006/01/09/2504.html#Feedback12http://www.shnenglu.com/sandy/comments/commentRss/2504.htmlhttp://www.shnenglu.com/sandy/services/trackbacks/2504.html1.鏃犵┓loop

int i,a[10];
for(i=0;i<=10;++i)
{
     a[i] 
= 0 ;
}

why?
鍑芥暟榪愯鏃跺爢鏍堬細
a[0] a[1] ....a[9] i
a[10] = 0;鏀瑰彉i鐨勫間負0,閫犳垚鏃犵┓寰幆

2.鍏繘鍒剁殑璇敤

int i[] = {    012,
                  
024,
                  
125,
           };


涓轟簡瀵歸綈鍙兘閫犳垚鐨勯敊璇紝鍙樻垚浜嗗叓榪涘埗

3.濡備綍璋冪敤鍦板潃涓?鐨勮繃紼嬶紵
(*(void(*)())0)();
ps:鍦ㄥぇ澶氭暟鐜頒唬鎿嶄綔緋葷粺錛岃繘紼嬪紩鐢ㄧ殑鍦板潃涓鴻櫄鎷熷湴鍧錛屾墍浠ヨ繖涓皟鐢ㄥ彲鑳藉悎娉?/P>


4.榪愮畻絎︾殑浼樺厛綰?/STRONG>

int i = 1;
= i<<4 + 2;

榪欐椂i鐨勫兼槸澶氬皯錛?BR>涓嶆槸18錛屾槸64錛屽洜涓?i=i<<4+2; <==> i=i<<(4+2);

5.鎮寕鐨刬f

if(x==0//1
      if(y==0) error(); //2
else//3
       z=x+y;
       f(
&z);
}

C涓殑else鎬繪槸鍜屾渶榪戠殑if鍖歸厤錛屾墍浠?鍜?鍖歸厤錛岃屼笉鏄拰1鍖歸厤銆傜瓑浠蜂簬

if(x==0//1
{
      
if(y==0) error(); //2
      else//3
           z=x+y;
           f(
&z);
      }
}


瑙e喅鏂規硶錛氭繪槸浣跨敤{}鍜宨f閰嶅

           



灝忔槑 2006-01-09 14:04 鍙戣〃璇勮
]]>
C++鎬ц兘浼樺寲瀹炶返2---閫夋嫨鍚堥傜殑瀹瑰櫒http://www.shnenglu.com/sandy/archive/2006/01/05/2448.html灝忔槑灝忔槑Thu, 05 Jan 2006 05:07:00 GMThttp://www.shnenglu.com/sandy/archive/2006/01/05/2448.htmlhttp://www.shnenglu.com/sandy/comments/2448.htmlhttp://www.shnenglu.com/sandy/archive/2006/01/05/2448.html#Feedback1http://www.shnenglu.com/sandy/comments/commentRss/2448.htmlhttp://www.shnenglu.com/sandy/services/trackbacks/2448.html
涓嬮潰鐨勪竴涓緥瀛愶紝鏄粡甯稿湪欏圭洰涓兘浼氱敤鍒扮殑.ini閰嶇疆鏂囦歡鐢熸垚鍜岃В鏋愮殑榪囩▼
姣斿

[section1]
   key1 = value1 ;here is comment
   key2 = value2
[section2]
   key3 = value3
   key4 = value4

褰撶劧WinAPI涔熸彁渚涗簡WritePrivateProfileString,GetPrivateProfileString涓や釜API鏉ヨ鍐欒繖縐嶆枃浠舵牸寮忥紝浣嗘槸
姣忔浣跨敤閮戒細鎵撳紑鏂囦歡鏉ヨ鍐欙紝鎬ц兘闈炲父浣庯紝鍙傜敤浜庡皬瑙勬ā鐨勬暟鎹鍐欍?BR>
鐪嬫垜浠殑浠g爜錛?BR>
#define _TD_INI_H_

#include 
<list>
#include 
<fstream>
using namespace std;
class KEV_VALUE
{
public:
        KEV_VALUE(){m_bIsGarbage
=FALSE;m_bSingleLine=FALSE;};
        
virtual ~KEV_VALUE(){};
        
string m_key;
        
string m_value;
        BOOL m_bIsGarbage;
        BOOL m_bSingleLine;
};
typedef list
<KEV_VALUE> LIST_KEY_VELUE;

class SECTION
{
public:
        SECTION(){};
        
virtual ~SECTION(){};
        
string m_section;
        LIST_KEY_VELUE m_listKeyValue;
};
typedef list
<SECTION> LIST_SECTION;

class CTDIni  
{
public:
        CTDIni( 
void );
        
virtual ~CTDIni( void );
        BOOL UpdateData( BOOL bSave
=true );
        
void SetFileName( const CHAR *lpstrFileName );
        BOOL GetLastSectionName( 
string& str );
        BOOL AddSection( 
const CHAR *lpstrSection );
        BOOL DeleteSection( 
const CHAR *lpstrSection);
        BOOL ReadSection( 
const CHAR *lpszSection, string& str );        
        BOOL SetKeyValue( 
const CHAR *lpstrSection, const CHAR *lpstrKey, const CHAR *lpstrValue );
        BOOL SetKeyValue( 
const CHAR *lpstrSection, const CHAR *lpstrKey, const INT32 nValue );
        BOOL GetKeyValue( 
const CHAR *lpstrSection, const CHAR *lpstrKey, CHAR *lpstrValue );
        BOOL DeleteKeyValue( 
const CHAR *lpstrSection, const CHAR *lpstrKey );
        BOOL ChangeKeyName( 
const CHAR *lpstrSection, const CHAR *lpstrKeyOld, const CHAR *lpstrKeyNew );
        BOOL ChangeSectionName( 
const CHAR *lpstrSectionOld, const CHAR *lpstrSectionNew );
private:
        LIST_SECTION m_sections;
        
string m_strFileName;
        BOOL AddGarbage( 
const CHAR *lpstrSection, const CHAR *lpstrGarbage, BOOL bSingleLine=FALSE );
};

#endif // !defined(_TD_INI_H_)

榪欎釜鏄В鏋愮被鐨勫0鏄庯紝閲嶈鐨勬槸瀹冪殑鏁版嵁緇撴瀯錛屽畠閲囩敤浜嗕袱綰ч摼琛ㄧ殑緇撴瀯錛岀涓綰ф槸鎵鏈塻ection鐨刲ist,絎簩綰ф槸section涓嬮潰鐨刱ey-value鐨刲ist.
涓嬮潰鏄叾涓殑瀹炵幇浠g爜鐗囨柇

BOOL CTDIni::SetKeyValue( const CHAR *lpstrSection, const CHAR *lpstrKey, const CHAR *lpstrValue )
{
        LIST_SECTION::iterator i;
        
for( i = m_sections.begin(); i != m_sections.end(); i++ )
        {
                
if( (*i).m_section == lpstrSection )
                {
                        LIST_KEY_VELUE::iterator j;
                        
for( j = (*i).m_listKeyValue.begin(); j != (*i).m_listKeyValue.end(); j++ )
                        {
                                
if( (*j).m_key == lpstrKey )
                                {
                                        (
*j).m_value = lpstrValue;
                                        
return TRUE;
                                }
                        }

                        KEV_VALUE tmp;
                        tmp.m_key 
= lpstrKey;
                        tmp.m_value 
= lpstrValue;
                        (
*i).m_listKeyValue.push_back( tmp );
                        
return TRUE;
                }
        }
        
return FALSE;
}

涓婇潰鐨勪竴涓柟娉曟槸娣誨姞涓涓煎埌閰嶇疆涓幓錛屽畠鐨勭畻娉曟槸棣栧厛鏌ユ壘瀹冩墍鍦ㄧ殑section,鐒跺悗鏌ユ壘鎵鍦ㄧ殑key,
鏈鍚庡喅瀹氭槸insert榪樻槸update.

榪欐牱鎬ц兘闂灝辨潵浜嗭紝褰撴暟鎹笉鏂鍔狅紝SetKeyValue鎵闇瑕佺殑鏃墮棿鍛圢*N鐨勬柟寮忓闀褲傚緢鍙曘侰PU鐨勫崰鐢ㄧ巼涔熶細璺戝埌寰堥珮銆?BR>
鏈鍚庯紝鎴戜滑涓嶅緱涓嶈繘琛屼紭鍖栵紝鍥犱負鍦ㄦ垜浠殑欏圭洰涓紝涓嶅瓨鍦ㄧ浉鍚岀殑section錛屼篃娌℃湁鐩稿悓鐨刱ey,鎵浠ユ垜浠嬌鐢╩ap錛屼嬌寰楁煡鎵炬椂闂村彉鎴愬父鏁扮駭鍒?鍗充嬌鏈夌浉鍚岀殑key&section,涔熷彲浠ヤ嬌鐢╩ultimap)

浼樺寲鍚庣殑鏁版嵁緇撴瀯鏄繖鏍風殑

#include <string>
#include 
<stdio.h>
#include 
<list>
#include 
<map>
#include 
<fstream>

using namespace std;

struct VELUE
{
        
string m_value;
        BOOL m_bIsGarbage;
        BOOL m_bSingleLine;
};

typedef std::map
<std::string,VELUE> MAP_KEY_VELUE;

typedef std::map
<std::string,MAP_KEY_VELUE>  MAP_SECTION;

class CTDIni  
{
public:
        CTDIni( 
void );
        
virtual ~CTDIni( void );

        BOOL UpdateData( BOOL bSave
=true );

        
void SetFileName( const CHAR *lpstrFileName );

        BOOL GetLastSectionName( 
string& str );

        BOOL AddSection( 
const CHAR *lpstrSection );
        BOOL DeleteSection( 
const CHAR *lpstrSection);
        BOOL ReadSection( 
const CHAR *lpszSection, string& str );        
        BOOL IsExistSection( 
const CHAR *lpstrSection);

        BOOL SetKeyValue( 
const CHAR *lpstrSection, const CHAR *lpstrKey, const CHAR *lpstrValue );
        BOOL SetKeyValue( 
const CHAR *lpstrSection, const CHAR *lpstrKey, const INT32 nValue );
        BOOL GetKeyValue( 
const CHAR *lpstrSection, const CHAR *lpstrKey, CHAR *lpstrValue );
        BOOL DeleteKeyValue( 
const CHAR *lpstrSection, const CHAR *lpstrKey );
        BOOL ChangeKeyName( 
const CHAR *lpstrSection, const CHAR *lpstrKeyOld, const CHAR *lpstrKeyNew );
        BOOL ChangeSectionName( 
const CHAR *lpstrSectionOld, const CHAR *lpstrSectionNew );
private:
        MAP_SECTION m_sections;
        
string m_strFileName;
        BOOL AddGarbage( 
const CHAR *lpstrSection, const CHAR *lpstrGarbage, BOOL bSingleLine=FALSE );
};


SetKeyValue閭d釜鏂規硶鐨勫疄鐜版槸榪欐牱錛?BR>
BOOL CTDIni::SetKeyValue( const CHAR *lpstrSection, const CHAR *lpstrKey, const CHAR *lpstrValue )
{
        MAP_SECTION::iterator i;
        MAP_KEY_VELUE::iterator j;

        i 
= m_sections.find(lpstrSection);
        
if ( i == m_sections.end())
        {
                
return FALSE;
        }

        j 
= i->second.find(lpstrKey);
        
if( j != i->second.end()) //update
        {
                j
->second.m_value = lpstrValue;
        }
        
else //insert
        {
                VELUE tmp;
                tmp.m_value 
= lpstrValue;
                tmp.m_bSingleLine 
= false;
                tmp.m_bIsGarbage 
= false;
                i
->second[lpstrKey] = tmp;
        }
        
return TRUE;
}

涓よ呯殑鎬ц兘宸窛鏈夊澶э紵瓚呰繃浣犵殑鎯寵薄

灝忔槑 2006-01-05 13:07 鍙戣〃璇勮
]]>
鍒╃敤boost::serialization鏉ュ疄鐜癈++ RMIhttp://www.shnenglu.com/sandy/archive/2005/12/29/2236.html灝忔槑灝忔槑Thu, 29 Dec 2005 06:42:00 GMThttp://www.shnenglu.com/sandy/archive/2005/12/29/2236.htmlhttp://www.shnenglu.com/sandy/comments/2236.htmlhttp://www.shnenglu.com/sandy/archive/2005/12/29/2236.html#Feedback5http://www.shnenglu.com/sandy/comments/commentRss/2236.htmlhttp://www.shnenglu.com/sandy/services/trackbacks/2236.html
鍏堟潵涓猙oost::serlization浣跨敤鐨勪緥瀛?BR>

#include 
<boost/archive/text_oarchive.hpp>
#include 
<boost/archive/text_iarchive.hpp>
#include 
<boost/archive/xml_oarchive.hpp>
void test_serialization()
{
    boost::archive::text_oarchive to(cout , boost::archive::no_header);
    
int i = 10;
    
string s = "This is a test\n";
    to 
& i;
    to 
& s;

    ofstream f(
"test.xml");
    boost::archive::xml_oarchive xo(f);
    xo 
& BOOST_SERIALIZATION_NVP(i) & BOOST_SERIALIZATION_NVP(s);

    boost::archive::text_iarchive ti(cin , boost::archive::no_header);
    ti 
& i & s;
    cout 
<<"i="<< i << endl;
    cout 
<<"s="<< s << endl;
}

鍋囧鎴戜滑鍙互灝唎bject搴忓垪鍖栦互鍚庨氳繃socket浼犺繃鍘伙紝灝卞彲浠ュ疄鐜癛MI浜嗐?BR>褰撶劧榪欑鏂規硶鍙兘鏄湪C++紼嬪簭涔嬮棿浼犻掋?BR>
浠婂ぉ鍦╟odeproject涓婇潰鍙戠幇宸茬粡鏈変漢宸茬粡榪欐牱鍋氫簡錛屽師鏉ユ棭灝辨湁浜鴻窡鎴戞湁涓鏍風殑鎯蟲硶
鐪嬬湅浣滆呭皝瑁呯殑緇撴灉鍚?BR>
server绔?
#include <RCF/RCF.hpp> 

RCF_BEGIN(I_Echo, 
"I_Echo")
  RCF_METHOD_R1(std::
string, echo, const std::string &);
RCF_END(I_Echo);

class Echo
{
public:
  std::
string echo(const std::string &msg) { return msg; }
};

int main()
{
  
int port = 50001;
  RCF::RcfServer server(port);
  server.bind
<I_Echo, Echo>();
  server.start();
  
return 0;
}

client绔細

#include <RCF/RCF.hpp>

RCF_BEGIN(I_Echo, 
"I_Echo")
  RCF_METHOD_R1(std::
string, echo, const std::string &);
RCF_END(I_Echo);

int main()
{
  std::cout 
<< RcfClient<I_Echo>("localhost"
                               
50001).echo("my message");
  
return 0;
}

姣旇緝綆媧?鍒╃敤浜哹oost寮哄ぇ鐨刦unction,thread,serlization


RCF涓嬭澆鍦板潃:  http://www.codeproject.com/threads/RMI_For_Cpp/RCF.zip

浠嬬粛錛?http://www.codeproject.com/threads/RMI_For_Cpp.asp




灝忔槑 2005-12-29 14:42 鍙戣〃璇勮
]]>
C++鎬ц兘浼樺寲瀹炶返1---璁捐鏁版嵁緇撴瀯http://www.shnenglu.com/sandy/archive/2005/12/22/1973.html灝忔槑灝忔槑Thu, 22 Dec 2005 12:42:00 GMThttp://www.shnenglu.com/sandy/archive/2005/12/22/1973.htmlhttp://www.shnenglu.com/sandy/comments/1973.htmlhttp://www.shnenglu.com/sandy/archive/2005/12/22/1973.html#Feedback8http://www.shnenglu.com/sandy/comments/commentRss/1973.htmlhttp://www.shnenglu.com/sandy/services/trackbacks/1973.html瀵逛簬鎬ц兘浼樺寲錛岀浉淇″枩嬈++鐨勪漢閮芥槸姣旇緝閲嶈鏁堢巼銆傛垜鍑嗗鍐欎竴涓郴鍒楋紝涓昏鏄熀浜庢垜鐨勪竴浜涘疄璺碉紝鑷充簬鐞嗚涓婄殑涓滆タ錛屼笉鏄垜鐨勯噸鐐廣傛垜涔熻涓嶅嚭鏉ヤ竴鍫嗛亾鐞?-)銆傛垜鎵璇寸殑渚嬪瓙錛岄兘灝嗘槸鎴戜互鍓嶆墍閬囧埌鐨勪竴浜涙渚嬶紝璁板綍涓涓嬫濊礬錛屾嬁鍑烘潵璺熷ぇ瀹秙hare銆?BR>

鍦–++紼嬪簭涓紝鑷粠鏈変簡STL,寰堝皯鏈変漢鍘昏嚜宸卞幓璁捐鏁版嵁緇撴瀯錛屽綋鐒跺ぇ閮ㄥ垎鎯呭喌STL鐨勬晥鐜囬兘鏄彲浠ョ殑銆備竾浜嬮兘鏈変緥澶栥?BR>
鎴戞帴瑙﹀埌涓涓渶姹傦紝鏄牴鎹墜鏈哄彿鐮佺殑鍙鋒琛?浣嶆暟涓嶅畾錛屼竴鑸槸涓冨叓浣嶏級鏉ユ煡鍑烘墜鏈哄彿鐮佹墍鍦ㄧ殑鍦板尯銆?BR>姣斿
1315156   鍗椾含
13812345 鍖椾含
1366789  涓婃搗
025          鍗椾含

涓縐嶅彲鑳界殑鏂規鏄璁″涓猦ashmap
map<int,string> seg8; map<int,string> seg7;  map<int,string> seg3; ...
姣忎釜map鍒嗗埆瀵瑰簲涓嶅悓鐨勪綅鏁般傚浜庝竴涓猵hone,鍒嗗埆鍦ㄨ繖浜沵ap涓煡鎵?BR>浣嗘槸鏁堢巼涓嶈銆?BR>
榪欓噷闈㈡湁涓叧閿紝鍥犱負鎵嬫満鍙風爜閮芥槸鏁板瓧錛屾垜浠彲浠ヨ璁″嚭涓媯墊爲錛屾瘡涓妭鐐歸兘鏄?-9錛屼粬鍙互鏈?0涓妭鐐癸紝鍙跺瓙鑺傜偣鎴戜滑灝卞彲浠ュ偍瀛樻暟鎹傝繀閫熷湪澶ц剳閲屾兂璞′竴涓繖鏍風殑妯″瀷銆?BR>
榪樻槸鐪嬩唬鐮佹瘮杈冩槑浜嗐?鍗佸弶鏍?/STRONG>

#if !defined __TREE10__
#define __TREE10__

#pragma warning(disable:
4786)

namespace sandy
{
    
namespace Private  
    {
        template
<class VALUE>
            
struct __Node10  //鑺傜偣struct
        {
            typedef __Node10
<VALUE>* POINTER;
            VALUE 
* data; //鏁版嵁
            POINTER ptr[10]; //瀛愯妭鐐?/SPAN>
            
            __Node10():data(
0)
            {
                memset(ptr,
0,sizeof(POINTER)*10);
            }
        };
    }
    
    template
<typename VALUE>
        
class CTree10
    {
        typedef  Private::__Node10
<VALUE> NODE;
    
private:
        
long                    m_lcount;          //鎻掑叆鐨勬暟鎹暟閲?/SPAN>
        long                    m_lnodecount;      //鑺傜偣鏁?/SPAN>
        NODE*                    m_proot;           //鏍圭粨鐐規寚閽?/SPAN>
        
    
public:
        CTree10():m_lcount(
0),m_lnodecount(0),m_proot(CreateNode()) //notice:Keep order with their declare
        {
        }
        
~CTree10()
        {
            DestroyAll();
        }
        
        
void DestroyAll()
        {
            
for(short i =0;i<10;++i)
            {
                
if(m_proot->ptr[i]!=0)
                {
                    Remove(m_proot
->ptr[i]);
                    m_proot
->ptr[i] = 0;
                }
            }
        }
        
        
bool Insert(const char*pKey,const VALUE &data) //鎻掑叆鑺傜偣
        {
            assert(pKey
!=0);
            NODE 
* pNode = m_proot;
            NODE 
* pChildNode =0;
            
char c = 0;
            
            
for(unsigned int i=0;i<strlen(pKey);++i)
            {
                c 
= pKey[i];    if(c<'0' || c>'9'return false;
                pChildNode 
= pNode->ptr[(c-'0')];
                
if(pChildNode == 0//not build
                {
                    pChildNode 
= pNode->ptr[(c-'0')] = CreateNode();//create a new child
                }
                pNode 
= pChildNode ;//change node to child node
            }
            
            
if(pNode->data == 0//empty 
            {
                pNode
->data = new VALUE(data);
                
++m_lcount;
                
return true;
            }
            
else//already inserted
            {
                
return false;
            }
        }
        
        
bool Lookup(const char*pKey,VALUE &data,bool strick = true)
        {
            assert(pKey
!=0);
            NODE 
* pNode = m_proot;
            NODE 
* pChildNode =0;
            
char c = 0;
            
            
for(unsigned int i=0;i<strlen(pKey);++i)
            {
                c 
= pKey[i]; if(c<'0' || c>'9'return false;
                pChildNode 
= pNode->ptr[(c-'0')];
                
if(pChildNode!=0)
                {
                    pNode 
= pChildNode;
                }
                
else // can't find
                {
                    
if(!strick)
                    {
                        
break;
                    }
                    
return false;
                }
            }
            
            
if(pNode->data != 0//already inserted
            {
                data 
= *(pNode->data);
                
return true;
            }
            
else  // no inserted
            {
                
return false;
            }
        }
        
    
private:
        NODE 
*CreateNode()
        {
            NODE 
*pNewNode = new NODE();
            assert(pNewNode
!= 0);
            
++m_lnodecount;
            
return pNewNode;
        }
        
        
void Remove(NODE *pNode)
        {
            assert(pNode
!=0);
            
forshort i = 0 ; i < 10 ; i ++ )
            {
                
if( pNode -> ptr[ i ] )
                    Remove( pNode 
-> ptr[ i ] );
            }
            
if(pNode->data!=0)
            {
                delete pNode
->data;
                
--m_lcount;
            }
            
--m_lnodecount;
            delete pNode;
        }
    };
}

#endif


榪欎釜Tree10鎴戝湪vc6涓嬫祴璇曠殑緇撴灉錛?BR>鎻掑叆閫熷害姣攕td::map蹇?鍊嶏紝鏌ヨ閫熷害鍒欐槸std::map鐨?0鍊?BR>

 



灝忔槑 2005-12-22 20:42 鍙戣〃璇勮
]]>
vc6鍑芥暟璋冪敤嫻呮瀽http://www.shnenglu.com/sandy/archive/2005/12/14/1745.html灝忔槑灝忔槑Wed, 14 Dec 2005 08:53:00 GMThttp://www.shnenglu.com/sandy/archive/2005/12/14/1745.htmlhttp://www.shnenglu.com/sandy/comments/1745.htmlhttp://www.shnenglu.com/sandy/archive/2005/12/14/1745.html#Feedback5http://www.shnenglu.com/sandy/comments/commentRss/1745.htmlhttp://www.shnenglu.com/sandy/services/trackbacks/1745.html
鎴戝啓涓嬩簡濡備笅浠g爜錛?BR>
int fun(int a,int b)
{
    
int i = 3;
    
return a+b+i;
}

int main()
{
    
int a = 1,b=2;
    
int result ;
    result 
= fun(1,2);
    
return result;
}

闈炲父綆鍗曘傚弽姹囩紪鍚?Debug鐗?鍙樻垚榪欐牱

1:    int fun(int a,int b)
2:    {
00401020   push        ebp
00401021   mov         ebp,esp
00401023   sub         esp,44h
00401026   push        ebx
00401027   push        esi
00401028   push        edi
00401029   lea         edi,[ebp-44h]
0040102C   mov         ecx,11h
00401031   mov         eax,0CCCCCCCCh
00401036   rep stos    dword ptr [edi]
3:        int i = 3;
00401038   mov         dword ptr [ebp-4],3
4:        return a+b+i;
0040103F   mov         eax,dword ptr [ebp
+8]
00401042   add         eax,dword ptr [ebp+0Ch]
00401045   add         eax,dword ptr [ebp-4]
5:    }
00401048   pop         edi
00401049   pop         esi
0040104A   pop         ebx
0040104B   mov         esp,ebp
0040104D   pop         ebp
0040104E   ret

7:    int main()
8:    {
00401060   push        ebp
00401061   mov         ebp,esp
00401063   sub         esp,4Ch
00401066   push        ebx
00401067   push        esi
00401068   push        edi
00401069   lea         edi,[ebp-4Ch]
0040106C   mov         ecx,13h
00401071   mov         eax,0CCCCCCCCh
00401076   rep stos    dword ptr [edi]
9:        int a = 1,b=2;
00401078   mov         dword ptr [ebp-4],1
0040107F   mov         dword ptr [ebp
-8],2
10:       int result ;
11:       result = fun(1,2);
00401086   push        2
00401088   push        1
0040108A   call        @ILT
+5(fun) (0040100a)
0040108F   add         esp,
8
00401092   mov         dword ptr [ebp-0Ch],eax
12:       return result;
00401095   mov         eax,dword ptr [ebp-0Ch]
13:   }
00401098   pop         edi
00401099   pop         esi
0040109A   pop         ebx
0040109B   add         esp,4Ch
0040109E   cmp         ebp,esp
004010A0   call        __chkesp (004010c0)
004010A5   mov         esp,ebp
004010A7   pop         ebp
004010A8   ret

鎴戜滑涓昏鏉ョ湅鐪嬪嚱鏁拌皟鐢ㄩ儴鍒?BR>
1.鍙傛暟鍘嬫爤
push 2
push 1
鍙傛暟浠庡彸鍚戝乏鍘嬫爤(__cdcel),esp閫掑噺

2.璋冪敤鍑芥暟
 call        @ILT+5(fun) (0040100a)
榪欐潯鎸囦護浼氭妸涓嬩竴琛屼唬鐮佺殑鍦板潃鍘嬫爤錛屼篃灝辨槸鍑芥暟榪斿洖鍦板潃銆傚悓鏃惰煩杞埌鍑芥暟鍏ュ彛澶?BR>
3.榪涘叆鍑芥暟浣?/STRONG>
push        ebp
mov         ebp,esp
棣栧厛淇濆瓨ebp鐨勫湴鍧錛岀劧鍚庢妸esp淇濆瓨鍒癳bp涓幓
00401023   sub         esp,44h
00401026   push        ebx
00401027   push        esi
00401028   push        edi
鍑忓皬stack鐨勬寚閽?娉ㄦ剰錛宻tack鏄粠鍐呭瓨鐨勯珮绔悜浣庣鐢熼暱鐨?錛屼負灞閮ㄥ彉閲忎繚鐣欎竴浜涚┖闂達紝榪欓噷鐨?4h涓嶆槸鍥哄畾鐨勶紝鐢辯紪璇戝櫒璁$畻寰楁潵
00401029   lea         edi,[ebp-44h]
0040102C   mov         ecx,11h
00401031   mov         eax,0CCCCCCCCh
00401036   rep stos    dword ptr [edi]
鐢?xCC濉厖灞閮ㄥ彉閲忕┖闂淬傝繖鏄疍ebug妯″紡鐗規湁鐨勶紝濡傛灉鏄瓧絎︿覆錛屼綘灝辯湅鍒拌鍒濆鍖栨垚"鐑儷鐑儷鐑儷"
鑷蟲錛屾暣涓爢鏍堝彉鎴?BR>|-----------------|
|    灞閮ㄥ彉閲?   |
|-----------------|
|    灞閮ㄥ彉閲?    |<----ebp-4
|-----------------|
|    old ebp          |<----ebp
|-----------------|
| 鍑芥暟榪斿洖鍦板潃| <----ebp+4
|-----------------|
|      鍙傛暟1         | <----ebp+8
|-----------------|
|      鍙傛暟2         |
|-----------------|

Next:
int i = 3;
00401038   mov         dword ptr [ebp-4],3
榪欓噷浣犵湅鍒癧ebp-4]灝辨槸絎竴涓眬閮ㄥ彉閲廼浜?BR>0040103F   mov         eax,dword ptr [ebp+8]
00401042   add         eax,dword ptr [ebp+0Ch]
00401045   add         eax,dword ptr [ebp-4]
[ebp+8],[ebp+0Ch]鍒嗗埆鏄痑鍜宐浜?BR>
4.鍑芥暟榪斿洖
鍑芥暟鐨勭粨鏋滈兘鏄斁鍦╡ax涓?ps:浣犲彲浠ュ湪vc鐨剋atch紿楀彛杈撳叆@EAX錛屽氨鍙互鐩存帴鐪嬪埌鍑芥暟榪斿洖鍊間簡錛?BR>00401048   pop         edi
00401049   pop         esi
0040104A   pop         ebx
0040104B   mov         esp,ebp
0040104D   pop         ebp
0040104E   ret
鎶奺di,esi,ebx鎭㈠錛岀劧鍚庢仮澶峞sp,ebp,榪欐椂鍑芥暟鐨勮繑鍥炲湴鍧灝卞湪鏍堥《錛岃皟鐢╮et灝卞彲浠ヨ繑鍥炰簡銆?BR>

閭e鏋滄敼鍙樺嚱鏁扮殑榪斿洖鍦板潃浼氭庢牱錛?BR>ok,鎴戜滑淇敼涓涓嬩唬鐮侊細
#include <stdio.h>
void fun2()
{
    printf(
"fun2() called");
}

int fun(int a,int b)
{
    
int i = 3;
    printf(
"return address:0x%x\n",&i+2);
    printf(
"fun2 address:0x%x\n",&fun2);
    
/*int *p = (int*)&fun2;
    __asm
    {
        mov ebx,p
        mov dword ptr[ebp+4],ebx
    }
*/
    
*(&i+2)=(int)&fun2; //modify return address
    return a+b+i;
}

int main()
{
    
int a = 1,b=2;
    
int result ;
    result 
= fun(1,2);
    
return result;
}

Wow,榪欐椂錛屾垜浠氨浼氬彂鐜癴un2琚皟鐢ㄤ簡銆傝繖灝辨槸Buffer overrun(緙撳啿婧㈠嚭)鎵鍋氱殑浜嬫儏鍚с?BR>

5.鏈鍚庝竴姝ワ紝璋冪敤鑰呰皟鏁村爢鏍堟寚閽?/STRONG>
call        @ILT+5(fun) (0040100a)
 add         esp,8
涓轟粈涔堣璋冩暣鍛紝鍥犱負璋冪敤涔嬪墠push涓や釜鍙傛暟榪涘叆鏍堬紝鐜板湪瑕佹仮澶嶅畠
 mov         dword ptr [ebp-0Ch],eax
榪欏彞璇濆氨鏄韓鐢ㄥ嚱鏁拌皟鐢ㄧ殑鏋滃疄浜?EAX淇濆瓨浜嗗嚱鏁扮殑榪斿洖鍊?

------end--------




灝忔槑 2005-12-14 16:53 鍙戣〃璇勮
]]>
鑰冭冧綘瀵笴++瀵硅薄妯″瀷鐨勭悊瑙?/title><link>http://www.shnenglu.com/sandy/archive/2005/12/06/1557.html</link><dc:creator>灝忔槑</dc:creator><author>灝忔槑</author><pubDate>Tue, 06 Dec 2005 01:34:00 GMT</pubDate><guid>http://www.shnenglu.com/sandy/archive/2005/12/06/1557.html</guid><wfw:comment>http://www.shnenglu.com/sandy/comments/1557.html</wfw:comment><comments>http://www.shnenglu.com/sandy/archive/2005/12/06/1557.html#Feedback</comments><slash:comments>12</slash:comments><wfw:commentRss>http://www.shnenglu.com/sandy/comments/commentRss/1557.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/sandy/services/trackbacks/1557.html</trackback:ping><description><![CDATA[榪欐槸灝忔槑鎴戣嚜緙栫殑棰樼洰銆?BR><BR>1.璇峰湪涓嶈繍琛岀▼搴忕殑鎯呭喌涓嬶紝璇村嚭涓嬮潰鐨勭▼搴忚繍琛屽悗浼氬穿婧冧箞錛熷鏋滄槸錛屽湪鍝竴琛屻?BR><BR> <DIV style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><SPAN style="COLOR: #008080"> 1</SPAN> <SPAN style="COLOR: #000000">#include </SPAN><SPAN style="COLOR: #000000"><</SPAN><SPAN style="COLOR: #000000">stdio.h</SPAN><SPAN style="COLOR: #000000">></SPAN><SPAN style="COLOR: #000000"><BR></SPAN><SPAN style="COLOR: #008080"> 2</SPAN> <SPAN style="COLOR: #000000">#include </SPAN><SPAN style="COLOR: #000000"><</SPAN><SPAN style="COLOR: #000000">memory.h</SPAN><SPAN style="COLOR: #000000">></SPAN><SPAN style="COLOR: #000000"><BR></SPAN><SPAN style="COLOR: #008080"> 3</SPAN> <SPAN style="COLOR: #000000"></SPAN><SPAN style="COLOR: #0000ff">class</SPAN><SPAN style="COLOR: #000000"> Test <BR></SPAN><SPAN style="COLOR: #008080"> 4</SPAN> <SPAN style="COLOR: #000000">{ <BR></SPAN><SPAN style="COLOR: #008080"> 5</SPAN> <SPAN style="COLOR: #000000"></SPAN><SPAN style="COLOR: #0000ff">public</SPAN><SPAN style="COLOR: #000000">: <BR></SPAN><SPAN style="COLOR: #008080"> 6</SPAN> <SPAN style="COLOR: #000000">        Test() <BR></SPAN><SPAN style="COLOR: #008080"> 7</SPAN> <SPAN style="COLOR: #000000">        { <BR></SPAN><SPAN style="COLOR: #008080"> 8</SPAN> <SPAN style="COLOR: #000000">                memset(</SPAN><SPAN style="COLOR: #0000ff">this</SPAN><SPAN style="COLOR: #000000">,</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">,</SPAN><SPAN style="COLOR: #0000ff">sizeof</SPAN><SPAN style="COLOR: #000000">(</SPAN><SPAN style="COLOR: #000000">*</SPAN><SPAN style="COLOR: #0000ff">this</SPAN><SPAN style="COLOR: #000000">)); <BR></SPAN><SPAN style="COLOR: #008080"> 9</SPAN> <SPAN style="COLOR: #000000">        } <BR></SPAN><SPAN style="COLOR: #008080">10</SPAN> <SPAN style="COLOR: #000000">        </SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000"> s; <BR></SPAN><SPAN style="COLOR: #008080">11</SPAN> <SPAN style="COLOR: #000000">        </SPAN><SPAN style="COLOR: #0000ff">void</SPAN><SPAN style="COLOR: #000000"> test() <BR></SPAN><SPAN style="COLOR: #008080">12</SPAN> <SPAN style="COLOR: #000000">        { <BR></SPAN><SPAN style="COLOR: #008080">13</SPAN> <SPAN style="COLOR: #000000">                printf(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">test()\n</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">); <BR></SPAN><SPAN style="COLOR: #008080">14</SPAN> <SPAN style="COLOR: #000000">        }<BR></SPAN><SPAN style="COLOR: #008080">15</SPAN> <SPAN style="COLOR: #000000">        </SPAN><SPAN style="COLOR: #0000ff">void</SPAN><SPAN style="COLOR: #000000"> test1() <BR></SPAN><SPAN style="COLOR: #008080">16</SPAN> <SPAN style="COLOR: #000000">        { <BR></SPAN><SPAN style="COLOR: #008080">17</SPAN> <SPAN style="COLOR: #000000">                printf(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">test1():%d\n</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">,</SPAN><SPAN style="COLOR: #0000ff">this</SPAN><SPAN style="COLOR: #000000">-></SPAN><SPAN style="COLOR: #000000">s); <BR></SPAN><SPAN style="COLOR: #008080">18</SPAN> <SPAN style="COLOR: #000000">        }<BR></SPAN><SPAN style="COLOR: #008080">19</SPAN> <SPAN style="COLOR: #000000">        </SPAN><SPAN style="COLOR: #0000ff">virtual</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">void</SPAN><SPAN style="COLOR: #000000"> test2() <BR></SPAN><SPAN style="COLOR: #008080">20</SPAN> <SPAN style="COLOR: #000000">        { <BR></SPAN><SPAN style="COLOR: #008080">21</SPAN> <SPAN style="COLOR: #000000">                printf(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">test2()\n</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">); <BR></SPAN><SPAN style="COLOR: #008080">22</SPAN> <SPAN style="COLOR: #000000">        }<BR></SPAN><SPAN style="COLOR: #008080">23</SPAN> <SPAN style="COLOR: #000000">}; <BR></SPAN><SPAN style="COLOR: #008080">24</SPAN> <SPAN style="COLOR: #000000"><BR></SPAN><SPAN style="COLOR: #008080">25</SPAN> <SPAN style="COLOR: #000000"></SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000"> main() <BR></SPAN><SPAN style="COLOR: #008080">26</SPAN> <SPAN style="COLOR: #000000">{ <BR></SPAN><SPAN style="COLOR: #008080">27</SPAN> <SPAN style="COLOR: #000000">        Test </SPAN><SPAN style="COLOR: #000000">*</SPAN><SPAN style="COLOR: #000000">s; <BR></SPAN><SPAN style="COLOR: #008080">28</SPAN> <SPAN style="COLOR: #000000">        s</SPAN><SPAN style="COLOR: #000000">-></SPAN><SPAN style="COLOR: #000000">test(); <BR></SPAN><SPAN style="COLOR: #008080">29</SPAN> <SPAN style="COLOR: #000000">        s</SPAN><SPAN style="COLOR: #000000">-></SPAN><SPAN style="COLOR: #000000">test2(); <BR></SPAN><SPAN style="COLOR: #008080">30</SPAN> <SPAN style="COLOR: #000000">        s</SPAN><SPAN style="COLOR: #000000">-></SPAN><SPAN style="COLOR: #000000">test1(); <BR></SPAN><SPAN style="COLOR: #008080">31</SPAN> <SPAN style="COLOR: #000000">        </SPAN><SPAN style="COLOR: #0000ff">return</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">; <BR></SPAN><SPAN style="COLOR: #008080">32</SPAN> <SPAN style="COLOR: #000000">}</SPAN></DIV><BR>2 .淇敼涓涓嬶紝鍙堟槸鍦ㄥ摢涓琛屽憿錛?BR><BR> <DIV style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><SPAN style="COLOR: #008080"> 1</SPAN> <SPAN style="COLOR: #000000">#include </SPAN><SPAN style="COLOR: #000000"><</SPAN><SPAN style="COLOR: #000000">stdio.h</SPAN><SPAN style="COLOR: #000000">></SPAN><SPAN style="COLOR: #000000"><BR></SPAN><SPAN style="COLOR: #008080"> 2</SPAN> <SPAN style="COLOR: #000000">#include </SPAN><SPAN style="COLOR: #000000"><</SPAN><SPAN style="COLOR: #000000">memory.h</SPAN><SPAN style="COLOR: #000000">></SPAN><SPAN style="COLOR: #000000"><BR></SPAN><SPAN style="COLOR: #008080"> 3</SPAN> <SPAN style="COLOR: #000000"></SPAN><SPAN style="COLOR: #0000ff">class</SPAN><SPAN style="COLOR: #000000"> Test <BR></SPAN><SPAN style="COLOR: #008080"> 4</SPAN> <SPAN style="COLOR: #000000">{ <BR></SPAN><SPAN style="COLOR: #008080"> 5</SPAN> <SPAN style="COLOR: #000000"></SPAN><SPAN style="COLOR: #0000ff">public</SPAN><SPAN style="COLOR: #000000">: <BR></SPAN><SPAN style="COLOR: #008080"> 6</SPAN> <SPAN style="COLOR: #000000">        Test() <BR></SPAN><SPAN style="COLOR: #008080"> 7</SPAN> <SPAN style="COLOR: #000000">        { <BR></SPAN><SPAN style="COLOR: #008080"> 8</SPAN> <SPAN style="COLOR: #000000">                memset(</SPAN><SPAN style="COLOR: #0000ff">this</SPAN><SPAN style="COLOR: #000000">,</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">,</SPAN><SPAN style="COLOR: #0000ff">sizeof</SPAN><SPAN style="COLOR: #000000">(</SPAN><SPAN style="COLOR: #000000">*</SPAN><SPAN style="COLOR: #0000ff">this</SPAN><SPAN style="COLOR: #000000">)); <BR></SPAN><SPAN style="COLOR: #008080"> 9</SPAN> <SPAN style="COLOR: #000000">        } <BR></SPAN><SPAN style="COLOR: #008080">10</SPAN> <SPAN style="COLOR: #000000">        </SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000"> s; <BR></SPAN><SPAN style="COLOR: #008080">11</SPAN> <SPAN style="COLOR: #000000">        </SPAN><SPAN style="COLOR: #0000ff">void</SPAN><SPAN style="COLOR: #000000"> test() <BR></SPAN><SPAN style="COLOR: #008080">12</SPAN> <SPAN style="COLOR: #000000">        { <BR></SPAN><SPAN style="COLOR: #008080">13</SPAN> <SPAN style="COLOR: #000000">                printf(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">test()\n</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">); <BR></SPAN><SPAN style="COLOR: #008080">14</SPAN> <SPAN style="COLOR: #000000">        }<BR></SPAN><SPAN style="COLOR: #008080">15</SPAN> <SPAN style="COLOR: #000000">        </SPAN><SPAN style="COLOR: #0000ff">void</SPAN><SPAN style="COLOR: #000000"> test1() <BR></SPAN><SPAN style="COLOR: #008080">16</SPAN> <SPAN style="COLOR: #000000">        { <BR></SPAN><SPAN style="COLOR: #008080">17</SPAN> <SPAN style="COLOR: #000000">                printf(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">test1():%d\n</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">,</SPAN><SPAN style="COLOR: #0000ff">this</SPAN><SPAN style="COLOR: #000000">-></SPAN><SPAN style="COLOR: #000000">s); <BR></SPAN><SPAN style="COLOR: #008080">18</SPAN> <SPAN style="COLOR: #000000">        }<BR></SPAN><SPAN style="COLOR: #008080">19</SPAN> <SPAN style="COLOR: #000000">        </SPAN><SPAN style="COLOR: #0000ff">virtual</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">void</SPAN><SPAN style="COLOR: #000000"> test2() <BR></SPAN><SPAN style="COLOR: #008080">20</SPAN> <SPAN style="COLOR: #000000">        { <BR></SPAN><SPAN style="COLOR: #008080">21</SPAN> <SPAN style="COLOR: #000000">                printf(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">test2()\n</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">); <BR></SPAN><SPAN style="COLOR: #008080">22</SPAN> <SPAN style="COLOR: #000000">        }<BR></SPAN><SPAN style="COLOR: #008080">23</SPAN> <SPAN style="COLOR: #000000">}; <BR></SPAN><SPAN style="COLOR: #008080">24</SPAN> <SPAN style="COLOR: #000000"><BR></SPAN><SPAN style="COLOR: #008080">25</SPAN> <SPAN style="COLOR: #000000"></SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000"> main() <BR></SPAN><SPAN style="COLOR: #008080">26</SPAN> <SPAN style="COLOR: #000000">{ <BR></SPAN><SPAN style="COLOR: #008080">27</SPAN> <SPAN style="COLOR: #000000">        Test </SPAN><SPAN style="COLOR: #000000">*</SPAN><SPAN style="COLOR: #000000">s </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">new</SPAN><SPAN style="COLOR: #000000"> Test(); <BR></SPAN><SPAN style="COLOR: #008080">28</SPAN> <SPAN style="COLOR: #000000">        s</SPAN><SPAN style="COLOR: #000000">-></SPAN><SPAN style="COLOR: #000000">test(); <BR></SPAN><SPAN style="COLOR: #008080">29</SPAN> <SPAN style="COLOR: #000000">        s</SPAN><SPAN style="COLOR: #000000">-></SPAN><SPAN style="COLOR: #000000">test1(); <BR></SPAN><SPAN style="COLOR: #008080">30</SPAN> <SPAN style="COLOR: #000000">        s</SPAN><SPAN style="COLOR: #000000">-></SPAN><SPAN style="COLOR: #000000">test2(); <BR></SPAN><SPAN style="COLOR: #008080">31</SPAN> <SPAN style="COLOR: #000000">        </SPAN><SPAN style="COLOR: #0000ff">return</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">; <BR></SPAN><SPAN style="COLOR: #008080">32</SPAN> <SPAN style="COLOR: #000000">}</SPAN></DIV><BR>3.鍐嶄慨鏀逛竴涓嬶紝鎯呭喌浼氬浣曞憿錛?BR> <DIV style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><SPAN style="COLOR: #008080"> 1</SPAN> <SPAN style="COLOR: #000000">#include </SPAN><SPAN style="COLOR: #000000"><</SPAN><SPAN style="COLOR: #000000">stdio.h</SPAN><SPAN style="COLOR: #000000">></SPAN><SPAN style="COLOR: #000000"><BR></SPAN><SPAN style="COLOR: #008080"> 2</SPAN> <SPAN style="COLOR: #000000">#include </SPAN><SPAN style="COLOR: #000000"><</SPAN><SPAN style="COLOR: #000000">memory.h</SPAN><SPAN style="COLOR: #000000">></SPAN><SPAN style="COLOR: #000000"><BR></SPAN><SPAN style="COLOR: #008080"> 3</SPAN> <SPAN style="COLOR: #000000"></SPAN><SPAN style="COLOR: #0000ff">class</SPAN><SPAN style="COLOR: #000000"> Test <BR></SPAN><SPAN style="COLOR: #008080"> 4</SPAN> <SPAN style="COLOR: #000000">{ <BR></SPAN><SPAN style="COLOR: #008080"> 5</SPAN> <SPAN style="COLOR: #000000"></SPAN><SPAN style="COLOR: #0000ff">public</SPAN><SPAN style="COLOR: #000000">: <BR></SPAN><SPAN style="COLOR: #008080"> 6</SPAN> <SPAN style="COLOR: #000000">        Test() <BR></SPAN><SPAN style="COLOR: #008080"> 7</SPAN> <SPAN style="COLOR: #000000">        { <BR></SPAN><SPAN style="COLOR: #008080"> 8</SPAN> <SPAN style="COLOR: #000000">                memset(</SPAN><SPAN style="COLOR: #0000ff">this</SPAN><SPAN style="COLOR: #000000">,</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">,</SPAN><SPAN style="COLOR: #0000ff">sizeof</SPAN><SPAN style="COLOR: #000000">(</SPAN><SPAN style="COLOR: #000000">*</SPAN><SPAN style="COLOR: #0000ff">this</SPAN><SPAN style="COLOR: #000000">)); <BR></SPAN><SPAN style="COLOR: #008080"> 9</SPAN> <SPAN style="COLOR: #000000">        } <BR></SPAN><SPAN style="COLOR: #008080">10</SPAN> <SPAN style="COLOR: #000000">        </SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000"> s; <BR></SPAN><SPAN style="COLOR: #008080">11</SPAN> <SPAN style="COLOR: #000000">        </SPAN><SPAN style="COLOR: #0000ff">void</SPAN><SPAN style="COLOR: #000000"> test() <BR></SPAN><SPAN style="COLOR: #008080">12</SPAN> <SPAN style="COLOR: #000000">        { <BR></SPAN><SPAN style="COLOR: #008080">13</SPAN> <SPAN style="COLOR: #000000">                printf(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">test()\n</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">); <BR></SPAN><SPAN style="COLOR: #008080">14</SPAN> <SPAN style="COLOR: #000000">        }<BR></SPAN><SPAN style="COLOR: #008080">15</SPAN> <SPAN style="COLOR: #000000">        </SPAN><SPAN style="COLOR: #0000ff">void</SPAN><SPAN style="COLOR: #000000"> test1() <BR></SPAN><SPAN style="COLOR: #008080">16</SPAN> <SPAN style="COLOR: #000000">        { <BR></SPAN><SPAN style="COLOR: #008080">17</SPAN> <SPAN style="COLOR: #000000">                printf(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">test1():%d\n</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">,</SPAN><SPAN style="COLOR: #0000ff">this</SPAN><SPAN style="COLOR: #000000">-></SPAN><SPAN style="COLOR: #000000">s); <BR></SPAN><SPAN style="COLOR: #008080">18</SPAN> <SPAN style="COLOR: #000000">        }<BR></SPAN><SPAN style="COLOR: #008080">19</SPAN> <SPAN style="COLOR: #000000">        </SPAN><SPAN style="COLOR: #0000ff">virtual</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">void</SPAN><SPAN style="COLOR: #000000"> test2() <BR></SPAN><SPAN style="COLOR: #008080">20</SPAN> <SPAN style="COLOR: #000000">        { <BR></SPAN><SPAN style="COLOR: #008080">21</SPAN> <SPAN style="COLOR: #000000">                printf(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">test2()\n</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">); <BR></SPAN><SPAN style="COLOR: #008080">22</SPAN> <SPAN style="COLOR: #000000">        }<BR></SPAN><SPAN style="COLOR: #008080">23</SPAN> <SPAN style="COLOR: #000000">}; <BR></SPAN><SPAN style="COLOR: #008080">24</SPAN> <SPAN style="COLOR: #000000"><BR></SPAN><SPAN style="COLOR: #008080">25</SPAN> <SPAN style="COLOR: #000000"></SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000"> main() <BR></SPAN><SPAN style="COLOR: #008080">26</SPAN> <SPAN style="COLOR: #000000">{ <BR></SPAN><SPAN style="COLOR: #008080">27</SPAN> <SPAN style="COLOR: #000000">        Test s ;<BR></SPAN><SPAN style="COLOR: #008080">28</SPAN> <SPAN style="COLOR: #000000">        s.test(); <BR></SPAN><SPAN style="COLOR: #008080">29</SPAN> <SPAN style="COLOR: #000000">        s.test1(); <BR></SPAN><SPAN style="COLOR: #008080">30</SPAN> <SPAN style="COLOR: #000000">        s.test2(); <BR></SPAN><SPAN style="COLOR: #008080">31</SPAN> <SPAN style="COLOR: #000000">        </SPAN><SPAN style="COLOR: #0000ff">return</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">; <BR></SPAN><SPAN style="COLOR: #008080">32</SPAN> <SPAN style="COLOR: #000000">}</SPAN></DIV> <P><BR><BR><BR>鏈鍚庤涓涓嬬瓟妗堝惂<BR>絎竴棰樻槸鍦?9琛岋紝絎簩棰樺湪30琛岋紝鏈鍚庝竴棰樹笉鎶ラ敊銆?BR>濡傛灉浣犱笉鐭ラ亾涓轟粈涔堬紝寤鴻鐪嬬湅<<Inside the <a title="C++鍗氬" href="http://www.shnenglu.com/sandy" >c++</a> Object Model>><BR></P><img src ="http://www.shnenglu.com/sandy/aggbug/1557.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/sandy/" target="_blank">灝忔槑</a> 2005-12-06 09:34 <a href="http://www.shnenglu.com/sandy/archive/2005/12/06/1557.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>Just for fun:鑳借緭鍑鴻嚜韜唬鐮佺殑紼嬪簭http://www.shnenglu.com/sandy/archive/2005/12/02/1483.html灝忔槑灝忔槑Fri, 02 Dec 2005 02:58:00 GMThttp://www.shnenglu.com/sandy/archive/2005/12/02/1483.htmlhttp://www.shnenglu.com/sandy/comments/1483.htmlhttp://www.shnenglu.com/sandy/archive/2005/12/02/1483.html#Feedback21http://www.shnenglu.com/sandy/comments/commentRss/1483.htmlhttp://www.shnenglu.com/sandy/services/trackbacks/1483.html鏉′歡錛氫笉鍊熷姪浠諱綍鏂囦歡鎿嶄綔錛岃緭鍑虹▼搴忕殑source code.


紼嬪簭錛?BR>
#include <stdio.h>
char c[] = {0x7d,0x3b,0xa,0x69,0x6e,0x74,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0xa,0x7b,0xa,0x20,0x20,0x20,0x20,0x70,0x72,0x69,0x6e,0x74,0x66,0x28,0x22,0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x20,0x3c,0x73,0x74,0x64,0x69,0x6f,0x2e,0x68,0x3e,0x5c,0x6e,0x63,0x68,0x61,0x72,0x20,0x63,0x5b,0x5d,0x20,0x3d,0x20,0x7b,0x22,0x29,0x3b,0xa,0x20,0x20,0x20,0x20,0x66,0x6f,0x72,0x28,0x69,0x6e,0x74,0x20,0x69,0x3d,0x30,0x3b,0x69,0x3c,0x73,0x69,0x7a,0x65,0x6f,0x66,0x28,0x63,0x29,0x3b,0x2b,0x2b,0x69,0x29,0xa,0x20,0x20,0x20,0x20,0x7b,0xa,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x70,0x72,0x69,0x6e,0x74,0x66,0x28,0x22,0x30,0x78,0x25,0x78,0x2c,0x22,0x2c,0x63,0x5b,0x69,0x5d,0x29,0x3b,0xa,0x20,0x20,0x20,0x20,0x7d,0xa,0x20,0x20,0x20,0x20,0x70,0x72,0x69,0x6e,0x74,0x66,0x28,0x22,0x25,0x73,0x22,0x2c,0x63,0x29,0x3b,0xa,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x30,0x3b,0xa,0x7d,};
int main()
{
    printf(
"#include <stdio.h>\nchar c[] = {");
    
for(int i=0;i<sizeof(c);++i)
    {
        printf(
"0x%x,",c[i]);
    }
    printf(
"%s",c);
    
return 0;
}

鑷充簬鎬庝箞鍋氬埌鐨勶紝澶у鍙互鑷繁鐞㈢(

涓嶈繃涓嶈浠ヤ負鍙湁C鑳藉仛鍒幫紝java涔熷彲浠ュ摝





灝忔槑 2005-12-02 10:58 鍙戣〃璇勮
]]>
7国产欧美日韩综合天堂中文久久久久| 人人妻久久人人澡人人爽人人精品 | 亚洲女久久久噜噜噜熟女| 亚洲国产一成久久精品国产成人综合 | 日产精品久久久一区二区| 精品国产乱码久久久久久1区2区 | 久久久国产精品福利免费| 日本一区精品久久久久影院| 亚洲国产精品成人久久| 中文精品久久久久人妻不卡| 成人午夜精品久久久久久久小说| 亚洲国产精品嫩草影院久久| 青青久久精品国产免费看| 久久精品国产亚洲AV无码麻豆| 精品国产91久久久久久久a| 欧美精品一区二区久久| 伊人久久大香线蕉综合5g| 久久人妻少妇嫩草AV无码蜜桃| 日本精品久久久久中文字幕| 久久综合亚洲欧美成人| 久久国产美女免费观看精品| 亚洲精品乱码久久久久久蜜桃图片 | 精品久久久久久亚洲| 亚洲精品tv久久久久久久久久| 久久露脸国产精品| 亚洲国产精品无码久久SM| 久久精品夜夜夜夜夜久久| 青青草国产精品久久| 一极黄色视频久久网站| 久久精品a亚洲国产v高清不卡| 国产成人综合久久精品尤物| 久久久高清免费视频| 精品免费久久久久国产一区| 亚洲国产成人精品91久久久 | 热re99久久精品国99热| 久久久青草久久久青草| 亚洲一区精品伊人久久伊人| 国产亚洲精品自在久久| 亚洲中文字幕伊人久久无码| 国内精品伊人久久久久AV影院| 久久激情五月丁香伊人|