锘??xml version="1.0" encoding="utf-8" standalone="yes"?>C++鍗氬-cppopphttp://www.9087120.com/cppopp/zh-cnTue, 26 Mar 2019 14:44:26 GMTTue, 26 Mar 2019 14:44:26 GMT60utf8togb2312 璺钩鍙?/title><link>http://www.9087120.com/cppopp/archive/2018/11/06/216041.html</link><dc:creator>sheng</dc:creator><author>sheng</author><pubDate>Tue, 06 Nov 2018 08:59:00 GMT</pubDate><guid>http://www.9087120.com/cppopp/archive/2018/11/06/216041.html</guid><wfw:comment>http://www.9087120.com/cppopp/comments/216041.html</wfw:comment><comments>http://www.9087120.com/cppopp/archive/2018/11/06/216041.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.9087120.com/cppopp/comments/commentRss/216041.html</wfw:commentRss><trackback:ping>http://www.9087120.com/cppopp/services/trackbacks/216041.html</trackback:ping><description><![CDATA[<div><div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />-->#include<iconv.h> <br />#include <stdio.h><br /><br />#include<iconv.h><br /><span style="color: #0000FF; ">using</span> <span style="color: #0000FF; ">namespace</span> std;<br /><span style="color: #0000FF; ">int</span> utf8togb2312(<span style="color: #0000FF; ">const</span> <span style="color: #0000FF; ">char</span> *sourcebuf,size_t sourcelen,<span style="color: #0000FF; ">char</span> *destbuf,size_t destlen) {   <br /><br />iconv_t cd;   <br /><br /><span style="color: #0000FF; ">if</span>( (cd = iconv_open("gb2312","utf-8")) ==0 )     <br /><br />      <span style="color: #0000FF; ">return</span> -1;  <br /><br />memset(destbuf,0,destlen);   <br /><br /><span style="color: #0000FF; ">const</span> <span style="color: #0000FF; ">char</span> **source = &sourcebuf;   <br /><br /><span style="color: #0000FF; ">char</span> **dest = &destbuf;<br /><span style="color: #0000FF; ">if</span>(-1 == iconv(cd,source,&sourcelen,dest,&destlen))     <br /><br />     <span style="color: #0000FF; ">return</span> -1;   <br /><br />iconv_close(cd);   <br /><br /><span style="color: #0000FF; ">return</span> 0;   <br /><br />}<br /><span style="color: #0000FF; ">int</span> gb2312toutf8(<span style="color: #0000FF; ">const</span> <span style="color: #0000FF; ">char</span> *sourcebuf,size_t sourcelen,<span style="color: #0000FF; ">char</span> *destbuf,size_t destlen) {   <br /><br />iconv_t cd;   <span style="color: #0000FF; ">if</span>( (cd = iconv_open("utf-8","gb2312")) ==0 )     <br /><br /><span style="color: #0000FF; ">return</span> -1;   memset(destbuf,0,destlen);   <br /><br /><span style="color: #0000FF; ">const</span> <span style="color: #0000FF; ">char</span> **source = &sourcebuf;   <br /><br /><span style="color: #0000FF; ">char</span> **dest = &destbuf;<br />  <span style="color: #0000FF; ">if</span>(-1 == iconv(cd,source,&sourcelen,dest,&destlen))     <br /><br /><span style="color: #0000FF; ">return</span> -1;   </div></div><div></div><img src ="http://www.9087120.com/cppopp/aggbug/216041.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.9087120.com/cppopp/" target="_blank">sheng</a> 2018-11-06 16:59 <a href="http://www.9087120.com/cppopp/archive/2018/11/06/216041.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣璇勮</a></div>]]></description></item><item><title>绾跨姹?/title><link>http://www.9087120.com/cppopp/archive/2016/08/26/214233.html</link><dc:creator>sheng</dc:creator><author>sheng</author><pubDate>Fri, 26 Aug 2016 08:46:00 GMT</pubDate><guid>http://www.9087120.com/cppopp/archive/2016/08/26/214233.html</guid><wfw:comment>http://www.9087120.com/cppopp/comments/214233.html</wfw:comment><comments>http://www.9087120.com/cppopp/archive/2016/08/26/214233.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.9087120.com/cppopp/comments/commentRss/214233.html</wfw:commentRss><trackback:ping>http://www.9087120.com/cppopp/services/trackbacks/214233.html</trackback:ping><description><![CDATA[     鎽樿: 杞?#26462;?#38007;猦ttp://blog.csdn.net/u010984552/article/details/51887108涓轰粈涔堥渶瑕?#32510;跨姹?#37929;墠鐨勫澶氭暟缃戠粶鏈嶅姟鍣紝鍖呮嫭Web鏈嶅姟鍣?#37510;丒mail鏈嶅姟鍣互鍙婃暟鎹簱鏈嶅姟鍣瓑閮藉叿鏈?#28051;涓叡鍚岀偣?#32029;?#27688;鏄?#37719;?#28003;嶆椂闂村唴蹇呴澶勭悊?#26271;鐩?#23480;?#28598;?#37928;勮繛鎺?#29831;?#23033;傦紝浣?#28598;勭悊?#26882;闂?#37719;?#37929;稿杈冪煭銆?nbsp;浼?缁?#28598;?#32510;跨?#23339;?#35268;涓垜浠噰鐢?#37928;?#37832;嶅姟鍣?#22959;?#37736;嬪垯鏄?#28051;鏃?#37818;?#37721;楀埌璇?#23033;?#28052;?#37722;庯紝鍗?#37714;涘缓涓涓?#37826;?#37928;?#32510;跨?#23350;紝鐢?#29831;?#32510;跨?#23339;墽琛?#28000;?..  <a href='http://www.9087120.com/cppopp/archive/2016/08/26/214233.html'>闃?#29831;?#37711;?#37826;?/a><img src ="http://www.9087120.com/cppopp/aggbug/214233.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.9087120.com/cppopp/" target="_blank">sheng</a> 2016-08-26 16:46 <a href="http://www.9087120.com/cppopp/archive/2016/08/26/214233.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣璇勮</a></div>]]></description></item><item><title>澶?#32468;?#22959;紡鍜屽皬绔?#22959;紡http://www.9087120.com/cppopp/archive/2016/08/17/214189.htmlshengshengWed, 17 Aug 2016 06:21:00 GMThttp://www.9087120.com/cppopp/archive/2016/08/17/214189.htmlhttp://www.9087120.com/cppopp/comments/214189.htmlhttp://www.9087120.com/cppopp/archive/2016/08/17/214189.html#Feedback0http://www.9087120.com/cppopp/comments/commentRss/214189.htmlhttp://www.9087120.com/cppopp/services/trackbacks/214189.html
鎽樿嚜http://blog.csdn.net/hackbuteer1/article/details/7722667

鍦?鍚勭璁畻鏈轰綋绯?#32513;?#37835;?#28051;紝瀵?#27996;庡瓧鑺?#37510;佸瓧?#29905;鐨勫?#27194;偍鏈?#37714;?#37832;?#37813;涓嶅悓?#32029;?#27932;鑰屽紩鍙?#27996;?#29825;畻鏈?閫氫俊棰?鍩?#28051;?#28051;涓?#23536;堥噸瑕佺殑闂?#26864;橈紝鍗?#38315;氫俊鍙?#37826;?#27996;?#23092;佺殑?#20426;鎭?#37719;?#37711;?#38171;?#23011;旂壒銆佸瓧鑺?#37510;佸瓧銆?#37721;屽瓧?#29905;?#29905;锛?#25652;?#29831;互?#31880;涔堟牱鐨勯?#21700;?#24538;繘琛?#28028;?#38315;?#37510;傚鏋?#28051;?#26440;炬垚涓鑷?#37928;勮?#21227;垯?#32029;閫氫俊鍙?#37826;?#28751;嗘棤娉曡繘琛屾 纭?#37928;勭紪/璇戠爜浠?#38000;屽鑷?#38315;氫俊澶辫触銆?#37929;墠鍦?#37722;勭浣?#32495;?#37928;勮?#30075;鏈?#28051;?#38315;氬父?#22128;鐢?#37928;勫瓧鑺?#28699;樺偍鏈?#37714;?#28051;?#29781;?#37832;?#28051;?#32457;?#38171;欱ig-Endian鍜孡ittle-Endian?#32029;涓?#38344;?#37711;?#28000;庡瓧鑺?#25652;?#29831;磋捣銆?br />涓銆佷粈涔?#37828;瓧鑺?#25652;?br />?#29927;鑺?#25652;忥紝椤?#37722;嶆?#28052;夊瓧鑺?#37928;勯?#21700;簭?#32029;鍐?#28598;?#29831;?#28051;?#37721;氨鏄?#28598;?#27996;?#28051;涓瓧鑺傜被鍨?#37928;勬暟鎹?#37734;唴瀛?#28051;?#37928;勫瓨鏀?#26916;哄簭(涓涓瓧鑺?#37928;勬暟鎹綋?#21159;?#27688;鏃犻渶璋堥?#21700;簭鐨?#38338;?#26864;?#27996;?銆?/span>鍏跺疄澶?#38318;?#37714;?#27996;?#37734;疄闄?#37928;勫 鍙?#28051;?#38318;藉緢灏?#28028;?#37929;?#37818;?#37724;屽瓧鑺?#25652;?#37813;?#27996;?#38316;?#37510;傚敮鏈?#37734;?#29882;钩鍙颁互鍙?#32515;戠粶绋嬪簭涓瓧鑺?#25652;忔墠鏄?#28051;涓?#25652;?#29831;?#29722;?#38000;冭檻鐨?#38338;?#26864;?#37510;?br />
鍦?#37813;鏈?#37928;?#28000;?#32513;嶅瓧鑺?#25652;?#37928;?#37826;?#32468;?#28051;?#38318;?#28028;氭彁?#22476;?#29927; 鑺?#25652;?#37714;?#28051;?#28051;被锛欱ig-Endian鍜孡ittle-Endian?#32029;寮?#37922;爣鍑?#37928;Big-Endian鍜孡ittle-Endian鐨勫畾涔夊涓?#38171;?br />a) Little-Endian?#27688;鏄?#28003;?#28003;嶅瓧鑺?#37818;?#37824;?#37734;唴瀛?#37928;?#28003;?#37734;板潃绔紝楂?#28003;嶅瓧鑺?#37818;?#37824;?#37734;唴瀛?#37928;勯珮鍦板潃绔?#37510;?br />b) Big-Endian?#27688;鏄?#26946;?#28003;嶅瓧鑺?#37818;?#37824;?#37734;唴瀛?#37928;?#28003;?#37734;板潃绔紝浣?#28003;嶅瓧鑺?#37818;?#37824;?#37734;唴瀛?#37928;勯珮鍦板潃绔?#37510;?br />c) 缃戠粶?#29927;鑺?#25652;?#38171;TCP/IP鍚勫眰鍗?#29825;?#28751;嗗瓧鑺?#25652;忓畾涔?#28051;築ig-Endian?#32029;?#27932;姝TCP/IP鍗?#29825;?#28051;?#28003;跨敤鐨勫瓧鑺?#25652;?#38315;氬父绉?#28052;?#28051;?#32515;戠粶?#29927;鑺?#25652;?#37510;?br />
1.1 ?#31880;涔?#37828;?#26946;?浣?#37734;板潃绔?br />棣?#37711;堟垜浠?#29781;佺煡閬揅绋嬪簭鏄犲儚涓唴瀛?#37928;勭闂村?#20904;眬鎯?#37712;?#38171;氬湪銆奀涓?瀹?#32514;?#32459;?#37510;?#28051;?#37812;?#38000;?#37510;奤nix鐜?#28583;?#26946;?#32510;?#32514;?#32459;?#37510;?#28051;?#37832;?#37711;?#27996;庡唴瀛樼闂村?#20904;眬鎯?#37712;?#37928;?#29831;?#37828;庯紝澶?#38007;村涓嬪浘锛?br />----------------------- ?#28214;楂樺唴瀛?#37734;板潃 0xffffffff
鏍?#25652;?br />鏍?br />鏍堥
-----------------------

NULL (绌烘礊)
-----------------------
鍫?br />-----------------------
鏈?#37714;?#28654;?鍖?#37928;勬暟鎹?br />----------------------- 缁?#32457;版暟鎹?#23048;?br />鍒?#28654;?#37718;?#37928;勬暟鎹?br />-----------------------
姝?鏂?#23048;?浠爜娈?
----------------------- ?#28214;浣庡唴瀛?#37734;板潃 0x00000000
鐢?#37733;?#37721;互鐪嬪嚭?#32029;鍐嶅唴瀛?#37714;嗗竷涓紝鏍?#37828;?#37722;?#28051;嬪?#28858;?#36328;殑?#32029;鑰屽爢鏄?#37722;?#28051;?#28583;為?#36328;殑銆?/span>
?#20114;涓?#37733;?#28051;轰?#23338;鏋滄垜浠?#37734;?#37837;?涓?#37714;?#38320;?#28051;涓猽nsigned char buf[4]?#32029;?#20549;涔堣繖涓暟缁?#37721;?#38322;?#37734;?#37837;?#28051;婃槸濡?#28003;?#29999;冨眬鐨勫憿锛熺湅涓嬪浘锛?br />鏍?#25652;?锛堥珮鍦板潃锛?/span>
----------
buf[3]
buf[2]
buf[1]
buf[0]

----------
鏍堥 锛?#28003;?#37734;板潃锛?/strong>
鍏跺疄?#32029;?#22428;浠?#37721;互鑷?#23480;?#37734;?#32514;?#29831;?#37731;?#38322;岄潰鍒涘缓涓涓暟缁勶紝?#21159;鍚?#37714;嗗埆杈?#37713;烘暟缁勭?#23942;瘡涓?#37711;冪礌鐨勫?#26495;潃?#32029;?#28533;楠?#29831;?#28051;涓?#37510;?br />1.2 ?#31880;涔?#37828;?#26946;?浣庡瓧鑺?br />鐜?#37734;垜浠?strong>寮勬竻浜?#26946;?浣?#37734;板潃?#32029;鎺潃鑰冭檻楂?浣庡瓧鑺?/span>
銆?#37832;変簺鏂?#32468;?#28051;?#32457;?#28003;?#28003;嶅瓧鑺?#28051;烘渶浣?#37832;?#37825;?#28003;嶏紝楂?#28003;嶅瓧鑺?#28051;烘渶楂?#37832;?#37825;?#28003;?#37510;傚鏋滄垜浠?#37832;?#28051;涓?2浣嶆棤绗?#37721;?#37825;村瀷0x12345678?#32029;?#20549;涔堥珮浣?#37828;粈涔堬紝浣?#28003;?#37721;?#37828;粈涔堝憿锛?鍏跺疄?#32226;绠鍗?#37510;?span style="color: #ff0000;">鍦?#37719;佽繘鍒?#28051;垜浠?#38318;?#29831;撮潬宸?#26440;?#37928;?#37828;?#26946;?#28003;嶏紝闈?#37721;?#26440;?#37928;?#37828;?#28003;?#28003;嶏紝鍦?#37711;?#28000;栬繘鍒?#28052;?#37828;?#28641;?#23005;?#37510;傚氨鎷?0x12345678?#28533;璇达紝浠?#26946;?#28003;嶅埌浣?#28003;?#37928;勫瓧鑺備?#28615;鏄?x12銆?x34銆?x56鍜?x78銆?/strong>

楂?浣?#37734;板潃绔?#37724;岄珮/浣庡瓧鑺?#38318;藉?#21228;竻浜?#37510;傛垜浠?#37712;嶆潵鍥?#26916;?涓涓婤ig-Endian鍜孡ittle-Endian鐨勫畾涔夛紝骞?#37922;?#37733;剧璇?#37828;?#28051;?#32457;嶅瓧鑺?#25652;?#38171;?br />?#20114;unsigned int value = 0x12345678涓轰?#23350;紝鍒嗗埆鐪嬬?#23338;湪涓?#32457;嶅瓧鑺?#25652;?#28051;嬪叾瀛樺偍鎯?#37712;碉紝?#22428;浠?#37721;互鐢unsigned char buf[4]?#28533;琛?#32448;簐alue锛?br />Big-Endian: 浣?#37734;板潃瀛?#37824;鹃珮浣?/strong>?#32029;濡?#28051;嬪浘锛?br />鏍?#25652;?锛堥珮鍦板潃锛?br />---------------
buf[3] (0x78) -- 浣?#28003;?/span>
buf[2] (0x56)
buf[1] (0x34)
buf[0] (0x12) -- 楂?#28003;?/span>
---------------
鏍堥 锛?#28003;?#37734;板潃锛?br />
Little-Endian: 浣?#37734;板潃瀛?#37824;?#28003;?#28003;?/strong>?#32029;濡?#28051;嬪浘锛?br />鏍?#25652;?锛堥珮鍦板潃锛?br />---------------
buf[3] (0x12) -- 楂?#28003;?/span>
buf[2] (0x34)
buf[1] (0x56)
buf[0] (0x78) -- 浣?#28003;?/span>
--------------
鏍?椤?锛?#28003;?#37734;板潃锛?br />
浜?#37510;?#37722;勭?#23732;ndian
2.1 Big-Endian
璁畻鏈轰綋绯?#32513;?#37835;?#28051;?#28051;绉嶆?#24538;堪澶氬瓧鑺?#28699;樺偍椤哄簭鐨?#37832;?#29831;紝鍦繖绉?#37832;?#37714;?#28051;渶閲?#29781;佸瓧鑺?#38171;圡SB锛?#28699;?#37824;?#37734;渶浣?#32468;?#37928;勫?#26495;潃 涓?#37510;傞噰鐢繖绉?#37832;?#37714;?#37928;勫?#21229;悊鍣?#37832;IBM3700绯?#37714;?#37510;丳DP-10銆丮ortolora寰?#28598;勭悊鍣?#32495;?#37714;楀?#23680;粷澶?#28598;氭暟鐨RISC澶勭悊鍣?#37510;?br />+----------+
| 0x34 |<-- 0x00000021
+----------+
| 0x12 |<-- 0x00000020
+----------+
鍥?1锛氬?#23677;瓧鑺傛暟0x1234?#20114;Big-Endian鐨?#37826;瑰紡瀛?#37734;捣濮嬪?#26495;潃0x00000020涓?br />
鍦Big-Endian涓紝瀵?#27996;bit搴?#37714;?涓?#37928;勫簭鍙?#32514;?#37818;?#37826;瑰紡濡?#28051;?#38171;堜互鍙屽瓧鑺傛暟0x8B8A涓轰緥锛?#38171;?br />bit 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
+-----------------------------------------+
val | 1 0 0 0 1 0 1 1 | 1 0 0 0 1 0 1 0 |
+----------------------------------------+
鍥?2锛欱ig-Endian鐨刡it搴?#37714;楃紪?#29212;鏂瑰紡
2.2 Little-Endian
璁畻鏈轰綋绯?#32513;?#37835;?#28051;?涓绉嶆?#24538;堪澶氬瓧鑺?#28699;樺偍椤哄簭鐨?#37832;?#29831;紝鍦繖绉?#37832;?#37714;?#28051;渶涓?#38322;?#29781;佸瓧鑺?#38171;圠SB锛?#28699;?#37824;?#37734;渶浣?#32468;?#37928;勫?#26495;潃涓?#37510;傞噰鐢繖绉?#37832;?#37714;?#37928;勫?#21229;悊鍣?#37832;PDP-11銆乂AX銆?strong>Intel绯?#37714;楀井澶勭悊鍣?/span>
鍜?#28051;浜?#32515;戠粶閫氫俊璁?#28598;?#37510;?#29831;?#37832;?#29831;?#38340;?#27996;嗘?#24538;堪澶氬瓧鑺?#28699;樺偍椤哄簭澶栬?#27194;?#31295;父鐢潵鎻忚堪涓涓瓧鑺?#28051;?#37722;?#28051;?#23011;旂壒鐨?#37818;?#37824;炬搴?#37510;?br />
+----------+
| 0x12 |<-- 0x00000021
+----------+
| 0x34 |<-- 0x00000020
+----------+

鍥?锛氬?#23677;瓧鑺傛暟0x1234?#20114;Little-Endian鐨?#37826;瑰紡瀛?#37734;捣濮嬪?#26495;潃0x00000020涓?br />銆鍦?Little-Endian涓紝瀵?#27996;bit搴?#37714;?#28051;?#37928;勫簭鍙?#32514;?#37818;?#37724;孊ig-Endian鍒氬鐩?#37721;嶏紝鍏?#37826;瑰紡濡?#28051;?#38171;堜互鍙屽瓧鑺傛暟0x8B8A涓轰緥锛?#38171;?br />bit 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
+-----------------------------------------+
val | 1 0 0 0 1 0 1 1 | 1 0 0 0 1 0 1 0 |
+-----------------------------------------+
鍥?4锛歀ittle-Endian鐨刡it搴?#37714;楃紪?#29212;鏂瑰紡
娉剰锛?#38315;氬父?#22428;浠?#29831;?#37928;?#28051;?#37832;哄簭锛Host Order锛夊氨鏄?#38316;?#23536;狶ittle-Endian瑙勫垯銆?#37813;?#20114;?#32139;涓?#37721;?#28051;?#37832;轰箣闂?#29781;?#38315;?#26473;TCP/IP鍗?#29825;繘琛?#38315;氫俊鐨勬椂鍊欏氨?#28214;瑕?#29835;冪敤鐩稿簲鐨勫?#33445;暟?#32344;琛?#28051;?#37832;哄簭 锛圠ittle-Endian锛?#37724;?#32515;戠粶搴?#38171;Big-Endian锛?#37928;勮{鎹?#37510;?br />?#22128;鐢?Little-endian妯紡鐨凜PU瀵规搷浣滄暟鐨勫瓨鏀?#37826;瑰紡鏄?#28000;?#28003;庡瓧鑺傚埌楂樺瓧鑺傦紝鑰孊ig-endian妯紡瀵规搷浣滄暟鐨勫瓨鏀?#37826;瑰紡鏄?#28000;?#26946;樺瓧鑺傚埌浣庡瓧鑺?#37510;?32bit瀹?#37928;勬暟0x12345678鍦Little-endian妯紡CPU?#21812;瀛?#28051;?#37928;勫瓨鏀?#37826;瑰紡锛堝亣璁?#28000;?#37734;板潃0x4000寮濮嬪瓨鏀?#38171;?#28051;?#38171;?br />                                          ?#21812;瀛?#37734;板潃     0x4000     0x4001     0x4002     0x4003
                                          瀛?#37824;惧唴瀹?    0x78        0x56        0x34         0x12
鑰屽湪Big- endian妯紡CPU?#21812;瀛?#28051;?#37928;勫瓨鏀?#37826;瑰紡?#22447;涓?#38171;?br />                                          ?#21812;瀛?#37734;板潃     0x4000     0x4001     0x4002     0x4003
                                          瀛?#37824;惧唴瀹?    0x12         0x34        0x56         0x78
?#21503;浣?#37928;勫尯鍒?#28641;?#28051;?#38171;?br />

涓?#37510;丅ig-Endian鍜孡ittle-Endian浼?#32514;虹偣
Big-Endian浼樼偣锛?#38344;?#26851;?#37711;堟彁鍙?#26946;?#28003;嶅瓧鑺傦紝浣?#37804;?#37828;?#37721;互鐢?#37930;嬬?#23338;湪鍋忕浣?#32515;?#28051;?鐨勫瓧鑺傛潵纭畾?#32342;涓暟?#29927;鏄?姝暟杩?#37828;?#29840;熸暟銆?#28003;?#28051;嶅?#21615;煡閬繖涓暟鍊?#37832;?#28598;氶暱?#32029;鎴?#38000;?#28003;?#28052;?#28051;嶅?#21616;繃涓浜涘瓧鑺傛潵鐪嬭繖涓暟鍊?#37828;?#37722;?#37722;?#37832;夌鍙?#28003;?#37510;傝繖涓暟鍊?#37828;互瀹?#28000;?#29722;?#37813;?#37719;板?#28888;潵鐨勯?#21700;簭瀛?#37824;?#37928;勶紝鎵?#20114;浠?#27996;岃繘鍒跺埌鍗佽繘鍒?#37928;勫?#33445;暟?#22738;鍒?#37832;?#37825;?#37510;傚洜鑰岋紝瀵?#27996;?#28051;嶅悓瑕?#23033;?#37928;?#37832;?#37731;紝鍦?#29825;?#29825;?#28699;?#37721;?#37826;瑰紡?#26882;?#27688;浼?#28051;嶅悓銆?br />
Little-Endian浼樼偣锛氭彁鍙?#28051;涓紝涓?#28051;紝鍥?#28051;?#37812;?#38000;呮?#25774;暱?#29927;鑺傛暟鎹?#37928;?#23033;?#32514;栨寚浠互涓?#37711;?#28000;?#37813;鏈夋牸?#32033;鐩?#37722;?#37928;?#37826;瑰紡?#32344;琛?#38171;?#26851;?#37711;?#37734;?#37707;忕鍦板潃涓?鐨勫湴鏂规彁鍙栨渶浣?#28003;?#37928;勫瓧鑺傦紝?#27932;涓?#37734;板潃鍋忕鍜屽瓧鑺傛暟鏄?#28051;瀵?#28051;鐨勫叧绯伙紝澶?#38322;嶇搴?#37928;勬暟瀛?#37713;芥暟?#27688;鐩稿鍦板鏄?#37712;?#27996;?#37510;?br />
濡?#37835;?#28003;犲鍔犳暟?#29927;鐨勫硷紝浣?#37721;?#38003;藉湪宸?#26440;?#28583;?#37716;犳暟?#29927;锛堥珮浣?#38344;?#37816;囨暟鍑芥暟?#28214;瑕佹洿澶?#37928;勬暟?#29927;锛?#37510;??#27932;姝紝 缁忓父?#28214;瑕佸鍔?#28051;?#28003;嶆暟瀛楀苟绉诲姩瀛樺偍鍣?#38322;?#37813;鏈塀ig-endian椤哄簭鐨勬暟?#29927;?#32029;鎶婃墍鏈夋暟鍚?#37721;?#32457;伙紝?#32342;浼氬鍔?#29825;畻鏈?#37928;勫伐浣?#38322;?#37510;?#28051;嶈繃?#32029;浣跨敤Little- Endian鐨勫?#27194;偍鍣?#28051;?#28051;?#38322;?#29781;佺?#21227;瓧鑺?#37721;互瀛?#37734;?#28729;冨?#29112;潵鐨?#28003;?#32515;紝鏂?#37928;勬暟鍙互瀛?#37734;?#28729;?#37928;?#37721;?#26440;?#37928;勯珮浣嶅?#26495;潃閲?#37510;傝繖?#27688;鎰忓?#23815;潃璁畻鏈?#28051;?#37928;勬煇浜?#29825;畻鍙互鍙樺?#26945;?#26449;姞绠鍗?#37724;屽閫?#37510;?br />鍥?#37510;?#29831;?#37712;?#28051;涓狢鍑芥暟?#32029;?#23266;澶勭悊鍣?#37828;Big_endian鐨勶紝?#22447;杩?#37733;?锛涜嫢鏄疞ittle_endian鐨勶紝?#22447;杩?#37733;?銆?br />
  1. int checkCPU(void)  
  2. {  
  3.     union  
  4.     {  
  5.         int a;  
  6.         char b;  
  7.     }c;  
  8.     c.a = 1;  
  9.     return (c.b == 1);  
  10. }  
鍓?#37835;?#38171;?#37922;?#27996;庤仈鍚?#28003;union鐨勫瓨鏀?#26916;哄簭鏄?#37813;鏈夋垚鍛?#38318;?#28000;?#28003;?#37734;板潃寮濮嬪瓨鏀撅紝鍒?#37922;?#29831;?#37911;规氨鍙互杞?#37833;?#37734;拌幏寰?#27996;咰PU瀵瑰唴瀛橀噰鐢Little- endian杩?#37828;Big-endian妯紡璇?#37712;?#37510;?br />璇?#37828;?#38171;?br />1  鍦c涓紝?#20168;鍚?#28003;?#38171;堝叡鐢?#28003;?#38171;?#37928;勬暟鎹垚鍛?#38318;?#37828;?#28000;?#28003;?#37734;板潃寮濮嬪瓨鏀?#37510;?br />2  ?#23266;鏄皬绔?#22959;紡?#32029;鐢?#28003;?#37734;板潃?#22476;楂?#37734;板潃c.a瀛?#37824;?#28051;?x01 00 00 00?#32029;c.b琚?#29863;嬪?#28051;?x01锛?br />  ————————————————————————————
   鍦板潃 0x00000000 0x00000001 0x00000002 0x00000003
   c.a  01         00         00         00
   c.b  01         00        
  ————————————————————————————  
3  ?#23266;鏄?#28598;?#32468;?#22959;紡?#32029;鐢?#28003;?#37734;板潃?#22476;楂?#37734;板潃c.a瀛?#37824;?#28051;?x00 00 00 01?#32029;c.b琚?#29863;嬪?#28051;?x0锛?br />  ————————————————————————————
   鍦板潃 0x00000000 0x00000001 0x00000002 0x00000003
   c.a  00         00         00         01
   c.b  00         00                 
  ————————————————————————————  
4  鏍?#37817;c.b鐨勫?#37928;?#37807;?#37712;靛氨鍙互鍒?#37826;璫pu鐨?#22959;紡浜?#37510;?br />
涓句?#23350;紝涓涓?6?#32344;鍒舵暟鏄?0x11 22 33?#32029;鍏?#28699;?#37824;?#37928;?#28003;?#32515;?#37828;?br />鍦板潃0x3000 涓?#28699;?#37824;?1
鍦板潃0x3001 涓?#28699;?#37824;?2
鍦板潃0x3002 涓?#28699;?#37824;?3
?#32347;璧锋潵?#27688;鍐欐垚鍦板潃0x3000-0x3002涓?#28699;?#37824;?#27996;嗘暟鎹?x112233
鑰岃繖绉嶅瓨鏀?#37724;?#29723;?#32448;?#37826;瑰紡?#32029;姝?#28610;?#32471;?#37722;?#28598;?#32468;?#37510;?/span>
鍙?#28598;?#28051;涓?#23011;?#26440;冨?#30028;悊瑙?#37928;勫啓娉?#28641;?#28051;?#38171;?br />
  1. bool checkCPU()     // 濡?#37835;?#37828;?#28598;?#32468;?#22959;紡?#32029;杩?#37733;?#37930;?nbsp; 
  2. {  
  3.     short int test = 0x1234;  
  4.   
  5.     if( *((char *)&test) == 0x12)     // 浣?#37734;板潃瀛?#37824;鹃?#27194;瓧鑺傛暟鎹?nbsp; 
  6.         return true;  
  7.     else  
  8.         return false;  
  9. }  
  10.   
  11. int main(void)  
  12. {  
  13.     if( !checkCPU())  
  14.         cout<<"Little endian"<<endl;  
  15.     else  
  16.         cout<<"Big endian"<<endl;  
  17.   
  18.     return 0;  
  19. }  
鎴?#38000;?#28051;?#38344;?#28051;?#32457;嶅啓娉?#28052;?#37828;?#37721;互鐨?/span>
  1. int main(void)  
  2. {  
  3.     short int a = 0x1234;  
  4.     char *p = (char *)&a;  
  5.   
  6.     if( *p == 0x34)  
  7.         cout<<"Little endian"<<endl;  
  8.     else  
  9.         cout<<"Big endian"<<endl;  
  10.   
  11.     return 0;  
  12. }  
  13.   
  14. int main(void)  
  15. {  
  16.     short int a = 0x1234;  
  17.     char x0 , x1;  
  18.   
  19.     x0 = ((char *)&a)[0];  
  20.     x1 = ((char *)&a)[1];  
  21.   
  22.     if( x0 == 0x34)  
  23.         cout<<"Little endian"<<endl;  
  24.     else  
  25.         cout<<"Big endian"<<endl;  
  26.   
  27.     return 0;  
  28. }  


sheng 2016-08-17 14:21 鍙戣璇勮
]]>
杞?#26462;? C++ 铏氬?#33445;暟琛?#29785;?#37835;?/title><link>http://www.9087120.com/cppopp/archive/2016/06/30/213829.html</link><dc:creator>sheng</dc:creator><author>sheng</author><pubDate>Thu, 30 Jun 2016 07:36:00 GMT</pubDate><guid>http://www.9087120.com/cppopp/archive/2016/06/30/213829.html</guid><wfw:comment>http://www.9087120.com/cppopp/comments/213829.html</wfw:comment><comments>http://www.9087120.com/cppopp/archive/2016/06/30/213829.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.9087120.com/cppopp/comments/commentRss/213829.html</wfw:commentRss><trackback:ping>http://www.9087120.com/cppopp/services/trackbacks/213829.html</trackback:ping><description><![CDATA[     鎽樿: C++ 铏氬?#33445;暟琛?#29785;?#37835;?nbsp;闄?#37928;http://blog.csdn.net/haoel  ?#22688;a C++涓?#37928;勮?#27692;?#33445;暟鐨?#28003;?#37922;?#28051;?#29781;?#37828;疄鐜?#27996;?#28598;氭佺殑鏈?#37714;?#37510;?#37711;?#27996;?#28598;氭侊紝绠鑰岃涔嬪氨鏄?#37922;埗?#34987;鍨嬪埆鐨勬寚閽堟寚鍚?#37711;?#28699;愮被鐨勫疄渚嬶紝?#21159;鍚?#38315;?#26473;囩埗?#34987;鐨勬寚閽?#29835;冪敤?#30084;闄?#28699;愮被鐨勬垚鍛樺?#33445;暟銆傝繖绉嶆妧鏈?#37721;互璁埗?#34987;鐨勬寚閽?#37832;?#8220;澶?#32457;嶅舰鎬?#8221;?#32029;?#32342;鏄?#28051;绉嶆硾鍨嬫妧鏈?#37510;?#37813;璋?#23049;?#37736;嬫妧鏈紝璇寸櫧浜嗗氨鏄?#29831;?#37733;?#28003;跨敤涓?#37721;?..  <a href='http://www.9087120.com/cppopp/archive/2016/06/30/213829.html'>闃?#29831;?#37711;?#37826;?/a><img src ="http://www.9087120.com/cppopp/aggbug/213829.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.9087120.com/cppopp/" target="_blank">sheng</a> 2016-06-30 15:36 <a href="http://www.9087120.com/cppopp/archive/2016/06/30/213829.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣璇勮</a></div>]]></description></item><item><title>鍙?#23480;?#23049;曞垯----澶嶆?#20635;寚閽?#29785;?#37835;?/title><link>http://www.9087120.com/cppopp/archive/2016/04/14/213276.html</link><dc:creator>sheng</dc:creator><author>sheng</author><pubDate>Thu, 14 Apr 2016 05:49:00 GMT</pubDate><guid>http://www.9087120.com/cppopp/archive/2016/04/14/213276.html</guid><wfw:comment>http://www.9087120.com/cppopp/comments/213276.html</wfw:comment><comments>http://www.9087120.com/cppopp/archive/2016/04/14/213276.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.9087120.com/cppopp/comments/commentRss/213276.html</wfw:commentRss><trackback:ping>http://www.9087120.com/cppopp/services/trackbacks/213276.html</trackback:ping><description><![CDATA[<p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff; text-indent: 24pt;"><span style="margin: 0px; padding: 0px; font-size: large;"><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">棣?#37711;?#37930;嬬?#23338;涓?#28051;涓?#28601;?/span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">鏄?#38171;?/span></span></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?"> </span></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?"><span style="margin: 0px; padding: 0px; font-size: large;">int* ( *( *fun )( int* ) )[10];</span></span></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';"> </span></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="margin: 0px; padding: 0px; font-size: large;"><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">?#32342;鏄?#28051;涓?#28028;?#29825;?#37714;?#28699;?#38000;呮?#29111;埌澶存鐩?#37930;?#37510;佹?#29111;埌鎭?#37807;?#37928;勫?#33445;暟鎸?#38333;堝鏄?#37510;?#37734;?#37908;?#32513;?#37818;屾彙</span><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">C/C++</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">鐨勫鏄?#29831;?#23049;?#28052;嬪墠?#32029;涓嶅涔?#28051;?#30078;鐨勮?#21227;垯?#32029;鎯崇悊瑙?#28610;借繖?#34987;澶嶆?#20634;鏄?#37828;?#23011;?#26440;冨?#20276;毦鐨?#37510;?/span></span></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';"> </span></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff; text-indent: 24pt;"><span style="margin: 0px; padding: 0px; font-size: large;"><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">C/C++</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">鎵鏈?#28598;嶆潅鐨勫鏄?#32513;?#37835;勶紝閮?#37828;?#37922;?#37722;勭?#23941;鏄庡?#23677;鏋勬垚鐨?#37510;傚浣?#29785;?#29831;?#28598;嶆?#20635;寚閽堝鏄?#38171;?#37721;?#23480;?#23049;曞垯鏄?#28051;涓緢钁?#37722;?#37510;佸緢鏈?#37825;?#37928;?#37826;规硶銆?#28051;嶈繃?#32029;鍙?#23480;?#23049;曞垯鍏跺疄骞?#28051;?#37828;?/span><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">C/C++</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">?#29219;鍑?#38322;岄潰鐨勫唴瀹癸紝瀹?#37828;?#28000;?/span><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">C/C++</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">?#29219;鍑?#37928;勫鏄?#29785;勫畾涓?#35120;?#32510;?#37713;烘潵鐨?#37826;规硶銆?/span><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">C/C++</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">?#29219;鍑?#37928;勫鏄?#29785;勫垯?#32029;鏄?#37922;潵瑙?#37712;?#28641;?#28003;?#37714;涘缓澹?#37828;?#37928;勶紝鑰?#37721;?#23480;?#23049;曞垯鏄?#37922;潵瑙?#37712;?#28641;?#28003;?#26440;?#29831;?#28051;涓?#28601;?#37828;?#37928;勶紝浠庡?#23677;鐨勮搴?#37930;嬶紝涓?#38000;?#37721;互璇?#37828;?#28051;涓?#37929;?#37721;?#37928;勮繃绋?#37510;?#37721;?#23480;?#23049;曞垯鐨勮鏂?#37720;?#37826;?#37828;繖?#29297;璇?#37928;?#38171;?/span></span></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';"> </span></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';"><span style="margin: 0px; padding: 0px; font-size: large;">The right-left rule: Start reading the declaration from the innermost parentheses, go right, and then go left. When you encounter parentheses, the direction should be reversed. Once everything in the parentheses has been parsed, jump out of it. Continue till the whole declaration has been parsed.</span></span></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';"> </span></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';"> </span></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="margin: 0px; padding: 0px; font-size: large;"><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">?#32342;娈?#38011;?#37826;?#37928;勭炕璇?#28641;?#28051;?#38171;?/span></span></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';"> </span></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="margin: 0px; padding: 0px; font-size: large;"><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">鍙?#23480;?#23049;曞垯锛?#26851;?#37711;?#28000;庢渶閲岄潰鐨勫?#21976;嫭鍙?#37930;嬭捣?#32029;?#21159;鍚庡線鍙?#37930;嬶紝鍐嶅線宸?#37930;?#37510;?#23011;忓綋閬囧埌鍦嗘嫭鍙锋椂?#32029;?#27688;搴?#29831;?#37818;?#26462;?#38339;?#29831;?#37826;?#37722;?#37510;?#28051;鏃?#29785;?#37835;?#28729;屽?#21976;嫭鍙?#38322;岄潰鎵鏈?#37928;?#28051;滆?#21281;紝?#27688;璺?#37713;?#37734;嗘嫭鍙?#37510;?#38322;?#28598;嶈繖涓?#26473;?#32459;?#37929;村埌鏁?#28051;?#28601;?#37828;?#29785;?#37835;?#28729;屾瘯銆?/span></span></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';"> </span></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="margin: 0px; padding: 0px; font-size: large;"><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';"><span style="margin: 0px; padding: 0px;">    </span></span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">绗?#38000;?#29781;佸?#30789;繖涓?#23049;曞垯?#32344;琛?#28051;涓皬?#30380;鐨勪慨姝紝搴?#29831;?#37828;?#28000;?#37832;畾涔?#37928;勬爣璇嗙寮濮?#38339;?#29831;伙紝鑰?#28051;?#37828;?#28000;庢嫭鍙?#29831;昏捣?#32029;涔嬫墍?#20114;鏄?#37832;畾涔?#37928;勬爣璇嗙?#32029;鏄洜涓?#28051;涓?#28601;?#37828;?#38322;岄潰鍙兘鏈?#28598;?#28051;爣璇嗙?#32029;浣?#37832;畾涔?#37928;勬爣璇嗙鍙?#28028;氭湁涓涓?#37510;?/span></span></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';"> </span></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="margin: 0px; padding: 0px; font-size: large;"><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';"><span style="margin: 0px; padding: 0px;">    </span></span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">鐜?#37734;?#38315;?#26473;?#28051;浜?#28186;嬪瓙?#28533;璁?#29825;?#37721;?#23480;?#23049;曞垯鐨勫簲鐢紝鍏?#28000;庢渶绠鍗?#37928;勫濮嬶紝閫?#23005;?#37716;犳繁锛?/span></span></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';"> </span></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';"><span style="margin: 0px; padding: 0px; font-size: large;">int (*func)(int *p);</span></span></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';"> </span></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="margin: 0px; padding: 0px; font-size: large;"><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">棣?#37711;?#37813;惧埌?#20549;涓?#37832;畾涔?#37928;勬爣璇嗙?#32029;?#27688;鏄?/span><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">func</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">?#32029;瀹?#37928;勫闈?#37832;?#28051;瀵?#37734;嗘嫭鍙凤紝鑰?#28051;?#23480;?#26440;?#37828;?#28051;涓?/span><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">*</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">鍙凤紝?#32342;璇?#37828;?/span><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">func</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">鏄?#28051;涓?#37816;?#38333;堬紝?#21159;鍚?#29882;?#37713;鸿繖涓?#37734;嗘嫭鍙凤紝鍏?#37930;?#37721;?#26440;癸紝涔?#37828;?#28051;涓?#37734;嗘嫭鍙凤紝?#32342;璇?#37828;?/span><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">(*func)</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">鏄?#28051;涓?#37713;芥暟?#32029;鑰?/span><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">func</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">鏄?#28051;涓?#37816;?#37722;戣繖?#34987;鍑芥暟鐨勬寚閽堬紝?#27688;鏄?#28051;涓?#37713;芥暟鎸?#38333;堬紝?#32342;?#34987;鍑芥暟?#21503;鏈?/span><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">int*</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">?#34987;鍨?#37928;勫舰鍙傦紝杩?#37733;?#37706;肩被鍨嬫槸</span><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">int</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">銆?/span></span></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';"> </span></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';"><span style="margin: 0px; padding: 0px; font-size: large;">int (*func)(int *p, int (*f)(int*));</span></span></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';"> </span></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="margin: 0px; padding: 0px; font-size: large;"><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">func</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">琚?#28051;瀵规嫭鍙?#37718;?#37722;紝涓?#23480;?#26440;?#37832;?#28051;涓?/span><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">*</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">鍙凤紝璇?#37828;?/span><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">func</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">鏄?#28051;涓?#37816;?#38333;堬紝璺?#37713;烘嫭鍙凤紝鍙?#26440;?#28052;?#37832;?#28051;嫭鍙凤紝?#20549;涔?/span><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">func</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">鏄?#28051;涓?#37816;?#37722;?#37713;芥暟鐨勬寚閽堬紝?#32342;?#34987;鍑芥暟?#21503;鏈?/span><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">int *</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">鍜?/span><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">int (*)(int*)</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">?#32342;?#29297;鐨勫舰鍙傦紝杩?#37733;?#37706;?#28051;?/span><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">int</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">?#34987;鍨?#37510;傚?#23942;潵鐪?#28051;鐪?/span><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">func</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">鐨勫舰鍙?/span><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">int (*f)(int*)</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">?#32029;?#34987;浼煎墠闈?#37928;勮閲婏紝</span><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">f</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">涔?#37828;?#28051;涓?#37713;芥暟鎸?#38333;堬紝鎸?#37722;?#37928;勫?#33445;暟?#21503;鏈?/span><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">int*</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">?#34987;鍨?#37928;勫舰鍙傦紝杩?#37733;?#37706;?#28051;?/span><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">int</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">銆?/span></span></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';"> </span></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';"><span style="margin: 0px; padding: 0px; font-size: large;">int (*func[5])(int *p);</span></span></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';"> </span></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="margin: 0px; padding: 0px; font-size: large;"><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">func</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">鍙?#26440;?#37828;?#28051;涓?/span><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">[]</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">杩愮畻绗紝璇?#37828;?/span><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">func</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">鏄?#28051;涓叿鏈?/span><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">5</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">涓?#37711;冪礌鐨勬暟缁勶紝</span><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">func</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">鐨勫乏杈?#37832;?#28051;涓?/span><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">*</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">?#32029;璇?#37828;?/span><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">func</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">鐨勫?#20906;礌鏄?#37816;?#38333;堬紝瑕?#23049;?#37808;忚繖閲?#37928;?/span><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">*</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">涓?#37828;?#28103;?#26967;?/span><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">func</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">鐨勶紝鑰?#37828;?#28103;?#26967;?/span><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">func[5]</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">鐨勶紝鍘熷洜鏄?/span><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">[]</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">杩愮畻绗?#28028;?#37711;?#32510;?#23011;?/span><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">*</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">楂橈紝</span><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">func</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">鍏?#29882;?/span><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">[]</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">缁?#37722;堬紝?#27932;姝?/span><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">*</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">淇?#26967;?#37928;?#37828;?/span><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">func[5]</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">銆?#29882;?#37713;鸿繖涓嫭鍙凤紝鐪?#37721;?#26440;癸紝涔?#37828;?#28051;瀵?#37734;嗘嫭鍙凤紝璇?#37828;?/span><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">func</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">?#26271;缁?#37928;勫?#20906;礌鏄?#37713;芥暟?#34987;鍨?#37928;勬寚閽堬紝瀹?#37813;鎸?#37722;?#37928;勫?#33445;暟?#21503;鏈?/span><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">int*</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">?#34987;鍨?#37928;勫舰鍙傦紝杩?#37733;?#37706;肩被鍨?#28051;?/span><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">int</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">銆?/span></span></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';"> </span></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';"> </span></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';"><span style="margin: 0px; padding: 0px; font-size: large;">int (*(*func)[5])(int *p);</span></span></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';"> </span></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="margin: 0px; padding: 0px; font-size: large;"><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">func</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">琚?#28051;涓?#37734;嗘嫭鍙?#37718;?#37722;紝宸?#26440;?#37721;?#37832;?#28051;涓?/span><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">*</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">?#32029;?#20549;涔?/span><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">func</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">鏄?#28051;涓?#37816;?#38333;堬紝璺?#37713;烘嫭鍙凤紝鍙?#26440;?#37828;?#28051;涓?/span><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">[]</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">杩愮畻绗?#37721;凤紝璇?#37828;?/span><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">func</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">鏄?#28051;涓?#37816;?#37722;戞暟缁?#37928;勬寚閽堬紝鐜?#37734;?#23536;宸?#37930;嬶紝宸?#26440;?#37832;?#28051;涓?/span><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">*</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">鍙凤紝璇?#37828;庤繖涓暟缁?#37928;勫?#20906;礌鏄?#37816;?#38333;堬紝鍐?#29882;?#37713;烘嫭鍙凤紝鍙?#26440;?#37721;?#37832;?#28051;涓嫭鍙凤紝璇?#37828;庤繖涓暟缁?#37928;勫?#20906;礌鏄?#37816;?#37722;?#37713;芥暟鐨勬寚閽?#37510;?#37804;?#32513;?#28051;涓嬶紝?#27688;鏄?#38171;?/span><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">func</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">鏄?#28051;涓?#37816;?#37722;戞暟缁?#37928;勬寚閽堬紝?#32342;涓暟缁?#37928;勫?#20906;礌鏄?#37713;芥暟鎸?#38333;堬紝?#32342;浜涙寚閽堟寚鍚戝叿鏈?/span><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">int*</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">褰?#37721;傦紝杩?#37733;?#37706;?#28051;?/span><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">int</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">?#34987;鍨?#37928;勫?#33445;暟銆?/span></span></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';"> </span></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';"><span style="margin: 0px; padding: 0px; font-size: large;">int (*(*func)(int *p))[5];</span></span></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';"> </span></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="margin: 0px; padding: 0px; font-size: large;"><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">func</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">鏄?#28051;涓?#37713;芥暟鎸?#38333;堬紝?#32342;?#34987;鍑芥暟?#21503;鏈?/span><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">int*</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">?#34987;鍨?#37928;勫舰鍙傦紝杩?#37733;?#37706;?#37828;?#37816;?#37722;戞暟缁?#37928;勬寚閽堬紝鎵鎸?#37722;?#37928;勬暟缁?#37928;勫?#20906;礌鏄叿鏈?/span><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">5</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">涓?/span><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">int</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">鍏冪礌鐨勬暟缁?#37510;?/span></span></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';"> </span></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="margin: 0px; padding: 0px; font-size: large;"><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">瑕?#23049;剰鏈変簺澶嶆?#20635;寚閽堝鏄?#37828;?#38344;?#23049;?#37928;勶紝渚嬪锛?/span></span></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';"> </span></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';"><span style="margin: 0px; padding: 0px; font-size: large;">int func(void) [5];</span></span></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';"> </span></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="margin: 0px; padding: 0px; font-size: large;"><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">func</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">鏄?#28051;涓?#26473;?#37733;?#37706;?#28051;哄叿鏈?/span><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">5</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">涓?/span><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">int</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">鍏冪礌鐨勬暟缁?#37928;勫?#33445;暟銆?#28003;?/span><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">C</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">璇言鐨勫?#33445;暟杩?#37733;?#37706;?#28051;嶈兘涓烘暟缁勶紝?#32342;鏄洜涓哄鏋?#37711;?#29825;稿?#33445;暟杩?#37733;?#37706;?#28051;烘暟缁勶紝?#20549;涔?#37818;?#37824;惰繖涓暟缁?#37928;勫唴瀹?#37928;?#28051;滆?#21281;紝涔?#36423;呴鏄?#28051;涓暟缁勶紝浣?/span><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">C/C++</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">璇言鐨勬暟缁勫悕鏄?#28051;涓?#28051;?#37721;?#28103;?#37824;?#37928;勫乏鍊硷紝瀹?#28051;嶈兘鐩?#37818;?#29722;?#37721;?#28051;涓暟缁?#37928;勫唴瀹逛慨鏀癸紝?#27932;姝?#37713;芥暟杩?#37733;?#37706;?#28051;嶈兘涓烘暟缁?#37510;?/span></span></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';"> </span></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';"><span style="margin: 0px; padding: 0px; font-size: large;">int func[5](void);</span></span></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';"> </span></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="margin: 0px; padding: 0px; font-size: large;"><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">func</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">鏄?#28051;涓叿鏈?/span><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">5</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">涓?#37711;冪礌鐨勬暟缁勶紝?#32342;涓暟缁?#37928;勫?#20906;礌閮?#37828;?#37713;芥暟銆傝繖涔?#37828;?#38344;?#23049;?#37928;勶紝?#27932;涓烘暟缁?#37928;勫?#20906;礌蹇呴鏄?#28725;硅薄?#32029;浣嗗?#33445;暟涓?#37828;?#28725;硅薄?#32029;涓嶈兘浣?#28051;烘暟缁?#37928;勫?#20906;礌銆?/span></span></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';"> </span></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff; text-indent: 24pt;"><span style="margin: 0px; padding: 0px; font-size: large;"><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">?#30084;闄?#32514;?#32459;嬪綋涓紝?#28214;瑕佸鏄?#28051;涓?#28598;嶆?#20635;寚閽堟椂?#32029;濡?#37835;滄?#23107;暣涓?#28601;?#37828;庡啓?#22426;涓?#38344;?#37813;绀鸿繖浜涘舰?#32033;?#32029;灏嗗鍙?#29831;?#37804;?#29999;潵涓?#30078;鐨?#37817;熷?#32029;搴?#29831;?#37922;?/span><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">typedef</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">?#28533;瀵瑰鏄?#38315;愬眰鍒?#29785;紝澧?#23534;?#37721;?#29831;?/span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">鎬?#37510;?/span></span></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff; text-indent: 24pt;"><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?"> </span></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff; text-indent: 24pt;"><span style="margin: 0px; padding: 0px; font-size: large;"><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">typedef</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">鏄?#28051;绉嶅鏄庯紝浣嗗?#20904;鏄?#37928;?#28051;?#37828;?#37721;?#38322;忥紝涔熸病鏈?#37714;涘缓鏂扮被鍨嬶紝鑰?#37828;煇绉嶇被鍨?#37928;勫埆鍚?#37510;?span style="margin: 0px; padding: 0px;">typedef</span>鏈夊緢澶?#37928;勭敤閫旓紝瀵?#28051;涓?#28598;嶆?#20634;鏄庤繘琛屽垎瑙互澧?#23534;?#37721;?#29831;?#37804;?#37828;?#37711;?#28003;?#37922;?#28052;?#28051;銆?/span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">渚嬪?#20634;浜庡鏄?#38171;?/span></span></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';"> </span></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';"><span style="margin: 0px; padding: 0px; font-size: large;">int (*(*func)(int *p))[5];</span></span></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';"> </span></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="margin: 0px; padding: 0px; font-size: large;"><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">鍙互?#32342;?#29297;鍒?#29785;?#38171;?/span></span></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';"> </span></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';"><span style="margin: 0px; padding: 0px; font-size: large;">typedef<span style="margin: 0px; padding: 0px;">  </span>int (*PARA)[5];</span></span></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';"><span style="margin: 0px; padding: 0px; font-size: large;">typedef PARA (*func)(int *);</span></span></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';"> </span></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="margin: 0px; padding: 0px; font-size: large;"><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">?#32342;?#29297;?#27688;瀹?#37828;撶?#23338;緱澶?#27996;?#37510;?/span></span></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';"> </span></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff; text-indent: 24pt;"><span style="margin: 0px; padding: 0px; font-size: large;"><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">typedef</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">鐨?#37721;?#28051;涓?#28003;?#37922;紝鏄?#28003;?#28051;哄?#36720;?#24225;?#30789;薄缂?#32459;?#37928;勯?#27194;眰鎶借薄鎵嬫銆?#37734;?/span><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">ADT</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">涓紝瀹?#37721;互鐢潵鍦?/span><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">C/C++</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">鍜岀?#26495;疄涓栫鐨勭墿浠?#38338;村缓绔嬪叧?#20168;?#32029;灏嗚繖浜涚墿浠?#37814;借薄?#22426;</span><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">C/C++</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">鐨勭被鍨?#32495;?#32513;?#37510;?#37734;?#29825;?#29825;?/span><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">ADT</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">鐨勬椂鍊欙紝?#22428;浠?#29999;稿?#31295;鏄庢煇涓?#37816;?#38333;?#37928;勫埆鍚嶏紝渚嬪锛?/span></span></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';"> </span></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';"><span style="margin: 0px; padding: 0px; font-size: large;">typedef struct node * list;</span></span></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';"> </span></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="margin: 0px; padding: 0px; font-size: large;"><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">浠?/span><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">ADT</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">鐨勮搴?#37930;嬶紝?#32342;涓?#28601;?#37828;?#37828;?#37712;?#38007;劧涓嶈繃鐨勪?#23339;儏?#32029;鍙互鐢?/span><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">list</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">?#28533;?#30078;涔?#28051;涓?#37714;?#29723;?#37510;?#28003;?#28000;?/span><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">C/C++</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">璇?#23049;?#37928;勮搴潵鐪嬶紝瀹?#37711;跺疄鏄?#28051;?#32471;?#37722;?/span><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">C/C++</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">澹?#37828;?#29831;?#23049;?#37928;?#38315;?#26440;?#37928;勶紝瀹冩?#26449;?#28056;湴灏嗘寚閽堝鏄?#32471;?#28000;庢寚閽堝鏄?#37731;?#28051;?#37714;嗙鍑烘潵?#32029;?#32342;浼?#38315;犳垚涓浜涘紓浜?#27996;轰滑闃?#29831;?#28052;?#37807;?#37928;勭?#25292;薄?#32029;鑰冭檻涓?#38344;?#28000;爜锛?/span></span></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';"> </span></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';"><span style="margin: 0px; padding: 0px; font-size: large;">const struct node *p1;</span></span></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';"><span style="margin: 0px; padding: 0px; font-size: large;">typedef struct node *list;</span></span></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';"><span style="margin: 0px; padding: 0px; font-size: large;">const list p2;</span></span></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';"> </span></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="margin: 0px; padding: 0px; font-size: large;"><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">p1</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">?#34987;鍨嬫槸</span><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">const struct node*</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">?#32029;?#20549;涔?/span><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">p2</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">?#25023;锛熷鏋?#28003;犱互涓哄氨鏄?#37814;?/span><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">list</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">绠鍗?#8220;浠?#37711;?#8221;</span><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">p2</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">?#32029;?#21159;鍚庡?#26944;嚭</span><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">p2</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">?#34987;鍨?#28052;?#37828;?/span><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">const struct node*</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">鐨勭粨鏋滐紝?#27688;澶?#38335;欑壒閿?#27996;?#37510;?/span><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">p2</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">鐨勭被鍨嬪?#36346;疄鏄?/span><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">struct node * const p2</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">?#32029;?#20549;涓?/span><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">const</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">闄愬畾鐨?#37828;?/span><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">p2</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">?#32029;涓?#37828;?/span><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">node</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">銆?#38315;犳垚?#32342;涓濂?#23534;傜?#25292;薄鐨勫?#29111;洜鏄?#37816;?#38333;堝鏄?#37731;?#29722;?#37714;嗗壊?#32029;?#29219;鍑?#28051;?#29785;勫畾锛?/span></span></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';"> </span></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="margin: 0px; padding: 0px; font-size: large;"><strong><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">6.7.5</span></strong><strong><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">.1 Pointer declarators</span></strong></span></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><strong><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';"> </span></strong></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><strong><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';"><span style="margin: 0px; padding: 0px; font-size: large;">Semantics</span></span></strong></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';"> </span></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';"><span style="margin: 0px; padding: 0px; font-size: large;"> If in the declaration ‘‘<strong>T D1<span style="margin: 0px; padding: 0px; font-weight: normal;">’</span><span style="margin: 0px; padding: 0px; font-weight: normal;">’, </span>D1 </strong>has the form</span></span></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';"> </span></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="margin: 0px; padding: 0px; font-size: large;"><strong><em style="margin: 0px; padding: 0px;"><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">*</span></em></strong><em style="margin: 0px; padding: 0px;"><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';"> type-qualifier-listopt </span></em><strong><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">D</span></strong></span></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><strong><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';"> </span></strong></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';"><span style="margin: 0px; padding: 0px; font-size: large;">and the type specified for <em style="margin: 0px; padding: 0px;">ident </em>in the declaration ‘‘<strong>T D</strong>’’ is</span></span></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';"> </span></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';"><span style="margin: 0px; padding: 0px; font-size: large;">‘‘<em style="margin: 0px; padding: 0px;">derived-declarator-type-list T</em>’’</span></span></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';"> </span></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';"><span style="margin: 0px; padding: 0px; font-size: large;">then the type specified for <em style="margin: 0px; padding: 0px;">ident </em>is</span></span></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';"> </span></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';"><span style="margin: 0px; padding: 0px; font-size: large;">‘‘<em style="margin: 0px; padding: 0px;">derived-declarator-type-list type-qualifier-list </em>pointer to <em style="margin: 0px; padding: 0px;">T</em>’’</span></span></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';"> </span></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';"><span style="margin: 0px; padding: 0px; font-size: large;">For each type qualifier in the list, <em style="margin: 0px; padding: 0px;">ident </em>is a so-qualified pointer.</span></span></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';"> </span></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="margin: 0px; padding: 0px; font-size: large;"><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">鎸?#38333;?#37928;勫鏄?#37731;?#37922;辨寚閽堝鏄?#32471;?/span><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">*</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">銆?#37721;?#38315;?#37928;勭被鍨?#38340;愬畾璇?/span><em style="margin: 0px; padding: 0px;"><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">type-qualifier-listopt</span></em><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">鍜屾爣璇嗙</span><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">D</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">缁勬垚?#32029;?#32342;涓?#38000;?#37734;?#38315;?#26440;?#28051;婃槸涓涓?#37825;?#28003;擄紝鏋勬垚涓涓?#28729;?#37825;?#37928;勬寚閽堝鏄?#37731;?#37510;傝繖涔?#37828;?#28598;?#28051;?#37721;?#38322;?#37722;屽?#26944;畾涔夋椂鎸?#38333;堝鏄?#32471;?#36423;呴?#33636;揣璺熸爣璇嗙鐨勫?#29111;洜?#32029;渚嬪锛?/span></span></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';"> </span></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';"><span style="margin: 0px; padding: 0px; font-size: large;">int *p, q, *k;</span></span></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';"> </span></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="margin: 0px; padding: 0px; font-size: large;"><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">p</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">鍜?/span><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">k</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">閮?#37828;?#37816;?#38333;堬紝浣?/span><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">q</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">涓?#37828;紝?#32342;鏄洜涓?/span><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">*p</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">銆?/span><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">*k</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">鏄?#28051;涓?#37825;?#28003;?#37816;?#38333;堝鏄?#37731;紝?#20114;琛?#32448;哄鏄?#37928;?#37828;?#28051;涓?#37816;?#38333;?#37510;?#32514;?#29831;?#37731;?#28028;氭?#23107;寚閽堝鏄?#32471;?#23480;?#26440;?#37928;勭被鍨?#37718;呮嫭鍏?#38340;愬畾璇?#28003;?#28051;烘寚閽堟寚鍚?#37928;勫疄浣?#37928;勭被鍨嬶紝鍙?#26440;?#37928;勯?#24876;畾璇?#38340;愬畾琚?#28601;?#37828;?#37928;勬爣璇嗙銆?#28003;嗙幇鍦?/span><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">typedef struct node *list</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">纭?#37922;?#37922;熸妸</span><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">*</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">浠?#37825;?#28051;?#37816;?#38333;堝鏄?#37731;?#28051;?#37714;嗙鍑烘潵?#32029;缂?#29831;?#37731;?#37813;?#28051;嶅埌</span><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">*</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">?#32029;浼?#29825;?#28051;?/span><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">const list p2</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">涓?#37928;?/span><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">const</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">鏄?#38340;愬畾</span><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">p2</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">鐨勶紝姝洜濡?#23005;紝</span><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">p2</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">鐨勭被鍨嬫槸</span><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">node * const</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">鑰?#28051;?#37828;?/span><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">const node</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">*</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">銆?/span></span></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?"> </span></p><p align="left" style=" padding: 0px; color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff; text-indent: 24pt;"><span style="margin: 0px; padding: 0px; font-size: large;"><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">铏界劧</span><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">typedef struct node* list</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">涓?#32471;?#37722;堝鏄?#29831;?#23049;?#37928;?#38315;?#26440;紝浣嗗?#36720;簬</span><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">typedef</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">鍦?/span><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">ADT</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">涓?#37928;?#38322;?#29781;?#28003;?#37922;互鍙婁俊鎭?#38341;愯棌鐨勮姹傦紝?#22428;浠?#25652;?#29831;?#29825;?#37922;?#37812;疯繖?#29297;浣跨敤</span><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">list A</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">?#32029;鑰?#28051;?#37828;?/span><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">list *A</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">?#32029;?#27932;姝?#37734;?/span><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">ADT</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">鐨勮璁?#28051;?#28000;嶅簲浣跨敤涓?#26473;?/span><span style="margin: 0px; padding: 0px; font-family: 'Times New Roman';">typedef</span><span style="margin: 0px; padding: 0px; font-family: 瀹?#28003;?">璇?#23049;曪紝浣嗛渶瑕?#23049;剰鍏跺甫?#28533;鐨?#28051;嶅褰卞搷銆?/span></span></p><img src ="http://www.9087120.com/cppopp/aggbug/213276.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.9087120.com/cppopp/" target="_blank">sheng</a> 2016-04-14 13:49 <a href="http://www.9087120.com/cppopp/archive/2016/04/14/213276.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣璇勮</a></div>]]></description></item><item><title>鏌?#37804;暟缁勭粨鏋勬垚鍛?/title><link>http://www.9087120.com/cppopp/archive/2016/04/14/213275.html</link><dc:creator>sheng</dc:creator><author>sheng</author><pubDate>Thu, 14 Apr 2016 03:14:00 GMT</pubDate><guid>http://www.9087120.com/cppopp/archive/2016/04/14/213275.html</guid><wfw:comment>http://www.9087120.com/cppopp/comments/213275.html</wfw:comment><comments>http://www.9087120.com/cppopp/archive/2016/04/14/213275.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.9087120.com/cppopp/comments/commentRss/213275.html</wfw:commentRss><trackback:ping>http://www.9087120.com/cppopp/services/trackbacks/213275.html</trackback:ping><description><![CDATA[<span style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;">C99涓紝缁?#37835;?#28051;?#37928;勬渶鍚?#28051;涓?#37711;冪礌鍏?#29825;?#37828;?#37832;煡澶皬鐨勬暟缁勶紝?#32342;?#27688;鍙?#37707;氭煍鎬暟缁勬垚鍛橈紝浣?#32513;?#37835;?#28051;?#37928;勬煍鎬暟缁勬垚鍛樺墠闈?#36423;呴鑷?#28751;?#28051;涓?#37711;?浠栨垚鍛?#37510;傛煍鎬暟缁勬垚鍛?#37711;?#29825;?#32513;?#37835;?#28051;?#37718;?#37722;?#28051;涓?#28598;皬鍙?#37721;?#37928;勬暟缁?#37510;俿izeof杩?#37733;?#37928;勮繖绉?#32513;?#37835;勫?#30380;涓嶅?#21614;嫭鏌?#37804;暟缁?#37928;勫唴瀛?#37510;?#37718;?#37722;?#37836;?#37804;暟缁勬垚鍛?#37928;勭粨鏋勭敤malloc ()鍑芥暟?#32344;琛屽唴瀛?#37928;勫姩鎬?#37714;?#38320;嶏紝骞?#28051;?#37714;?#38320;?#37928;勫唴瀛樺簲璇?#28598;?#27996;?#32513;?#37835;?#37928;勫?#30380;?#32029;?#20114;閫?#25652;?#37836;?#37804;暟缁?#37928;?#26864;?#37832;?#28598;皬銆?#37510;?nbsp;</span><br style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;" /><span style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;">C璇言澶?#37711;紝“鏌?#37804;暟缁勬垚鍛?#8221;</span><br style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;" /><br style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;" /><span style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;">銆愭煍鎬暟缁勭粨鏋勬垚鍛?/span><br style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;" /><span style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;">銆銆C99涓紝缁?#37835;?#28051;?#37928;勬渶鍚?#28051;涓?#37711;冪礌鍏?#29825;?#37828;?#37832;煡澶皬鐨勬暟缁勶紝?#32342;?#27688;鍙?#37707;氭煍鎬暟缁勬垚鍛橈紝浣?#32513;?#37835;?#28051;?#37928;勬煍鎬暟缁勬垚鍛樺墠闈?#36423;呴鑷?#28751;?#28051;涓?#37711;?浠栨垚鍛?#37510;傛煍鎬暟缁勬垚鍛?#37711;?#29825;?#32513;?#37835;?#28051;?#37718;?#37722;?#28051;涓?#28598;皬鍙?#37721;?#37928;勬暟缁?#37510;俿izeof杩?#37733;?#37928;勮繖绉?#32513;?#37835;勫?#30380;涓嶅?#21614;嫭鏌?#37804;暟缁?#37928;勫唴瀛?#37510;?#37718;?#37722;?#37836;?#37804;暟缁勬垚鍛?#37928;勭粨鏋勭敤malloc ()鍑芥暟?#32344;琛屽唴瀛?#37928;勫姩鎬?#37714;?#38320;嶏紝骞?#28051;?#37714;?#38320;?#37928;勫唴瀛樺簲璇?#28598;?#27996;?#32513;?#37835;?#37928;勫?#30380;?#32029;?#20114;閫?#25652;?#37836;?#37804;暟缁?#37928;?#26864;?#37832;?#28598;皬銆?#37510;?nbsp;</span><br style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;" /><span style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;">C璇言澶?#37711;紝“鏌?#37804;暟缁勬垚鍛?#8221;</span><br style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;" /><br style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;" /><span style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;">鐪嬬湅 C99 ?#29219;鍑?#28051;??#20242;娲绘暟缁勬垚鍛?#38171;?/span><br style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;" /><br style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;" /><span style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;">缁?#37835;?#28003;?#37721;?#38336;跨?#21227;鐢?#8212;—0涓?#37711;冪礌鐨勬暟缁?/span><br style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;" /><span style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;">鏈夋椂?#22428;浠渶瑕?#27996;?#37922;?#28051;涓?#32513;?#37835;?#28003;擄紝?#30084;鐜?#27996;?#28051;绉?#37721;?#37721;橀暱搴?#37928;勭粨鏋?#37510;傚浣曟潵?#30084;鐜板憿锛?/span><br style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;" /><span style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;">鐪嬭繖涓?#32513;?#37835;?#28003;?#37928;勫畾涔?#38171;?/span><br style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;" /><span style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;">typedef struct st_type</span><br style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;" /><span style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;">{</span><br style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;" /><span style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;">int nCnt;</span><br style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;" /><span style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;">int item[0];</span><br style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;" /><span style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;">}type_a;</span><br style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;" /><span style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;">锛?#37832;変簺缂?#29831;?#37731;?#28028;氭姤閿?#37827;?#23049;?#32514;?#29831;?#37721;互鏀规垚锛?#38171;?/span><br style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;" /><span style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;">typedef struct st_type</span><br style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;" /><span style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;">{</span><br style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;" /><span style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;">int nCnt;</span><br style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;" /><span style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;">int item[];</span><br style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;" /><span style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;">}type_a;</span><br style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;" /><span style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;">?#32342;鏍锋垜浠氨鍙互?#30078;涔?#28051;涓?#37721;?#37721;?#38336;跨?#21229;粨鏋勶紝鐢sizeof(type_a)寰楀埌鐨?#37721;?#37832;??#32029;?#27688;鏄痵izeof(nCnt)=sizeof(int)?#20549;</span><br style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;" /><br style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;" /><span style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;">涓?涓?#37711;冪礌鐨勬暟缁勬病鏈?#37719;?#37922;?#32460;?#38338;达紝鑰?#37722;庢垜浠?#37721;互?#32344;琛?#37721;橀暱?#25655;浣?#27996;?#37510;?/span><br style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;" /><span style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;">C璇言鐗?#38171;?/span><br style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;" /><span style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;">type_a *p = (type_a*)malloc(sizeof(type_a)+100*sizeof(int));</span><br style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;" /><span style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;">C++璇言鐗?</span><br style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;" /><span style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;">type_a *p = (type_a*)new char[sizeof(type_a)+100*sizeof(int)];</span><br style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;" /><span style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;">?#32342;鏍锋垜浠氨浜?#37922;?#27996;?#28051;涓暱涓?00鐨則ype_a?#34987;鍨?#37928;?#28051;滆?#36328;敤p->item[n]?#27688;?#20824;绠鍗?#37734;?#29825;?#38338;?#37721;?#37721;橀暱鍏冪礌?#32029;鍘熺悊鍗?#37714;?#32480;鍗?/span><br style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;" /><br style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;" /><span style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;">?#32029;鍒?#38320;?#27996;嗘瘮sizeof(type_a)澶?#37928;勫唴瀛?#37722;巌nt item[];?#27688;鏈変?#21975;叾?#21104;涔変簡?#32029;瀹?#37816;?#37722;?#37928;?#37828;痠nt nCnt;鍚?#38344;?#37928;勫唴瀹癸紝鏄病</span><br style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;" /><br style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;" /><span style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;">鏈夊唴瀛橀渶瑕佺殑?#32029;鑰屽湪鍒?#38320;嶆椂澶氬垎閰?#37928;勫唴瀛樺氨鍙互鐢?#37711;舵潵鎿嶆?#32029;鏄?#28051;?#37719;?#37714;嗗鐢?#37928;勬妧宸?#37510;?/span><br style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;" /><span style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;">鑰?#38322;婃斁鍚屾牱绠鍗?#38171;?/span><br style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;" /><span style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;">C璇言鐗?#38171;?/span><br style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;" /><span style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;">free(p);</span><br style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;" /><span style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;">C++璇言鐗?#38171;?/span><br style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;" /><span style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;">delete []p;</span><br style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;" /><span style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;">鍏跺疄?#32342;涓?#37721;伒娲绘暟缁勬垚鍛?fleible array member)C89涓嶆敮鎸佽繖绉?#28051;滆?#21281;紝C99鎶?#28729;?#28003;?#28051;?#28051;绉嶇壒渚嬪姞鍏?#27996;嗘爣鍑?#37510;?#28003;?/span><br style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;" /><br style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;" /><span style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;">鏄紝C99鎵鏀?#37816;佺殑鏄痠ncomplete type?#32029;鑰?#28051;?#37828;痾ero array?#32029;褰?#37722;宨nt item[0];?#32342;绉嶅舰?#32033;鏄?#38344;?#23049;?#37928;勶紝C99鏀?#37816;佺殑</span><br style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;" /><br style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;" /><span style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;">褰紡鏄?#35120;?#37722;宨nt item[];鍙?#28051;嶈繃鏈変簺缂?#29831;?#37731;?#37814;奿nt item[0];浣?#28051;?#38344;炴爣鍑嗘墿灞曟潵鏀?#37816;侊紝鑰?#28051;?#37734;C99鍙?#29999;?#28052;嬪墠宸?#32513;?#37832;?/span><br style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;" /><br style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;" /><span style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;">浜嗚繖绉?#38344;炴爣鍑嗘墿灞?#27996;嗭紝C99鍙?#29999;?#28052;?#37722;庯紝鏈変簺缂?#29831;?#37731;?#37814;?#28051;?#38000;?#37722;?#38000;?#28051;?#28051;銆?/span><br style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;" /><span style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;">涓?#38344;?#37828;疌99涓?#37928;?#37929;稿叧?#21812;瀹?#38171;?/span><br style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;" /><span style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;">6.7.2.1 Structure and union specifiers</span><br style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;" /><br style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;" /><span style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;">As a special case, the last element of a structure with more than one named member may have </span><br style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;" /><br style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;" /><span style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;">an incomplete array type; this is called a flexible array member. With two exceptions, the </span><br style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;" /><br style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;" /><span style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;">flexible array member is ignored. First, the size of the structure shall be equal to the offset </span><br style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;" /><br style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;" /><span style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;">of the last element of an otherwise identical structure that replaces the flexible array member </span><br style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;" /><br style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;" /><span style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;">with an array of unspecified length.106) Second, when a . (or ->) operator has a left operand </span><br style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;" /><br style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;" /><span style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;">that is (a pointer to) a structure with a flexible array member and the right operand names that </span><br style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;" /><br style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;" /><span style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;">member, it behaves as if that member were replaced with the longest array (with the same element </span><br style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;" /><br style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;" /><span style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;">type) that would not make the structure larger than the object being accessed; the offset of the </span><br style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;" /><br style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;" /><span style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;">array shall remain that of the flexible array member, even if this would differ from that of the </span><br style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;" /><br style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;" /><span style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;">replacement array. If this array would have no elements, it behaves as if it had one element but </span><br style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;" /><br style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;" /><span style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;">the behavior is undefined if any attempt is made to access that element or to generate a pointer </span><br style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;" /><br style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;" /><span style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;">one past it.</span><br style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;" /><span style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;">渚嬪鍦VC++6閲?#28003;跨敤涓?#38000;?#28052;?#28051;閮借兘閫?#26473;?#32514;?#29831;?#39582;?#28051;?#28729;屾垚?#25655;浣滐紝鑰?#28028;?#27996;?#37922;warning C4200: nonstandard extension </span><br style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;" /><br style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;" /><span style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;">used : zero-sized array in struct/union鐨勮鍛婃秷鎭?#37510;?/span><br style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;" /><span style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;">鑰屽湪DEVCPP閲?#28051;?#38000;?#37722;屾牱鍙互浣跨敤?#32029;骞?#28051;?#28051;?#28028;氭湁?#37723;婃秷鎭?#37510;?/span><img src ="http://www.9087120.com/cppopp/aggbug/213275.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.9087120.com/cppopp/" target="_blank">sheng</a> 2016-04-14 11:14 <a href="http://www.9087120.com/cppopp/archive/2016/04/14/213275.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣璇勮</a></div>]]></description></item><item><title>鍊?#23536;?#37818;崘鐨凜/C++妗嗘灦鍜屽簱http://www.9087120.com/cppopp/archive/2016/04/14/213270.htmlshengshengThu, 14 Apr 2016 02:03:00 GMThttp://www.9087120.com/cppopp/archive/2016/04/14/213270.htmlhttp://www.9087120.com/cppopp/comments/213270.htmlhttp://www.9087120.com/cppopp/archive/2016/04/14/213270.html#Feedback0http://www.9087120.com/cppopp/comments/commentRss/213270.htmlhttp://www.9087120.com/cppopp/services/trackbacks/213270.html闃?#29831;?#37711;?#37826;?/a>

sheng 2016-04-14 10:03 鍙戣璇勮
]]>
澶辫惤鐨凜璇言缁?#37835;?#28003;?#28751;佽?#21616;壓鏈?/title><link>http://www.9087120.com/cppopp/archive/2016/04/14/213268.html</link><dc:creator>sheng</dc:creator><author>sheng</author><pubDate>Thu, 14 Apr 2016 01:10:00 GMT</pubDate><guid>http://www.9087120.com/cppopp/archive/2016/04/14/213268.html</guid><wfw:comment>http://www.9087120.com/cppopp/comments/213268.html</wfw:comment><comments>http://www.9087120.com/cppopp/archive/2016/04/14/213268.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.9087120.com/cppopp/comments/commentRss/213268.html</wfw:commentRss><trackback:ping>http://www.9087120.com/cppopp/services/trackbacks/213268.html</trackback:ping><description><![CDATA[     鎽樿: Eric S. Raymond<esr@thyrsus.com>鐩?#35120;?. 璋?#29831;?#38339;?#29831;昏繖?#30226;鏂?#32468;?. ?#22428;涓轰粈涔?#37712;欒繖?#30226;鏂?#32468;?.瀵归綈瑕?#23033;?.濉?#37711;?.缁?#37835;?#28003;撳?#24402;綈鍙婂鍏?.缁?#37835;?#28003;?#38322;嶆帓搴?.闅句互澶勭悊鐨勬爣閲?#37928;?#37807;?#37712;?.鍙?#29831;?#37804;?#37724;岀瀛樺眬閮?#37804;?.鍏?#28000;?#28751;佽鐨勬妧鏈?0.宸叿11.璇?#37828;?#37721;?#28186;?#28598;?2.鐗?#37832;?#28766;?#37720;?nbsp;1. 璋?#29831;?#38339;?#29831;昏繖?#30226;鏂?#32468;?#37832;?#37826;?#37828;?#37711;?#27996;庡墛鍑廋璇言绋嬪簭?#21812;瀛?#37719;?#37922;?#32460;?#38338;?#37928;?#28051;椤规妧鏈?#8212;—涓轰?#21975;噺...  <a href='http://www.9087120.com/cppopp/archive/2016/04/14/213268.html'>闃?#29831;?#37711;?#37826;?/a><img src ="http://www.9087120.com/cppopp/aggbug/213268.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.9087120.com/cppopp/" target="_blank">sheng</a> 2016-04-14 09:10 <a href="http://www.9087120.com/cppopp/archive/2016/04/14/213268.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣璇勮</a></div>]]></description></item><item><title>浠庡疄鐜拌?#21620;鑰呮?#32033;涓?#37804;?#38000;僀++鎸?#38333;?#37724;屽紩鐢?#37928;?#38315;夋嫨(杞?http://www.9087120.com/cppopp/archive/2013/04/05/199118.htmlshengshengFri, 05 Apr 2013 03:27:00 GMThttp://www.9087120.com/cppopp/archive/2013/04/05/199118.htmlhttp://www.9087120.com/cppopp/comments/199118.htmlhttp://www.9087120.com/cppopp/archive/2013/04/05/199118.html#Feedback0http://www.9087120.com/cppopp/comments/commentRss/199118.htmlhttp://www.9087120.com/cppopp/services/trackbacks/199118.html

浠庡疄鐜拌?#21620;鑰呮?#32033;涓?#37804;?#38000;僀++鎸?#38333;?#37724;屽紩鐢?#37928;?#38315;夋嫨

 

鐨?#37719;氬?#32029;?#22428;瀵?#28729;冨仛浜?#32480;鍖?#37510;?#28003;?#28051;?#28051;涓?#32513;?#37711;?#37928;勮璁?#22959;紡?#32029;鏈?#38892;?#39582;舵病鏈?#28598;?#28598;?#29781;?#29831;?#37928;勫唴瀹?#37510;?#28003;?#37828;?#37734;垜灏?#29831;?#28003;跨敤C++鐨勮璁?#32513;?#37835;?#37510;?/span>

瑁呴鑰呮?#32033;

?#28533;杩?#37733;炲綋?#22688;铔?#32495;?#37928;勫悕绉帮紝鑰岃?#21620;鍣被鍙互瀵?#29831;?#38100;?#32495;?#37928;勫悕绉拌繘琛屼慨鏀?#29723;?#37711;?#37510;傚叿浣?#37928;勮泲绯曠被閮?#37832;?#38007;?#23480;?#37928;勫悕绉帮紝姣?#28641;?/span>CheeseCake?#32029;瀹?#37718;?#37722;?#27996;?#28051;涓?/span>Cake銆?#37734;畾涔夎?#21620;鍣?#37928;勬椂鍊欐垜浠?#37721;互浼?#38315;?#32513;欒?#21620;鍣?#28051;涓?#23480;?#32513;忓缓绔嬪鐨勮泲绯曞?#30789;薄?#32029;姣?#28641;?/span>CheeseCake鏄?/span>Cake?#22426;鍛樿褰?#28051;嬫潵銆?#37922;?#27996;庡叿浣?#37928;勮?#21620;鍣?#32513;?#37813;?#27996;庤?#21620;鍣?#37737;虹被Decorator鍙互琚?#37930;嬪埌?#32029;鍙堝洜涓鸿?#21620;鍣?#37832;?#38892;?#28052;?#37828;?#32513;?#37813;?#28051;?/span>Cake鐨?#37818;?#37721;紝?#32342;?#29297;鍦?#29761;呴鍣被?#21812;鐢?/span>getName鐨?/span>getName鐨勫?#24878;被?#32029;?#27932;姝?#29761;呴鍚?#37928;勮?#21620;鍣被瀵硅薄鍚屾椂涔?#37828;?#28051;涓叿浣?#37928;勮泲绯曞?#30789;薄?#32029;瀹?#37721;互琚?#37712;嶆瑁呴锛佽繖?#29297;瑁呴鍣被鍙?#37828;?#37734;垜浠?#38004;戞捣閲?#37928;?#37807;呭?#20904;氨鏄?#28051;涓?#37720;?#37832;?#37928;勮泲绯曞?#30789;薄澶?#26440;?#37718;呰浜?#28051;?#30512;?#30512;瑁呴鍣?#28725;硅薄銆?/span>

?#22426;鍛?#37928;勭被鍨?#38338;?#26864;橈紝涓鑸?#28003;跨敤鎸?#38333;堢被鍨?#37721;兘鏇寸鍚?/span>C++鎸?#38333;?#37928;勫湴鏂?#38318;?#37721;互鐢?#23534;?#37922;?#28000;?#37831;匡紝寮?#37922;?#28052;?#37832;夊緢澶氬澶?/span>~銆?#28051;嶈繃?#32029;?#32139;浣?#29831;?#28729;?#37832;?#37826;?#37812;?#29825;?#28003;犲氨涓?#28598;繖涔?#29825;?#28051;轰簡銆?#26851;?#37711;堬紝?#22428;浠?#37922;?/span>Cake*pCake#pragma once #include <iostream> using namespace std; //Cake鍏叡鍩虹被?#32029;?#24385;渚涜?#21620;鑰?#37724;岃瑁呴?#25198;墿鐨勭粺涓鎺?#37721;? class Cake { public: virtual string getName()const=0; }; //涓涓叿浣?#37928;勮泲绯? class CheeseCake:public Cake { public: virtual string getName()const { return string("濂舵?#30789;泲绯?); } }; //涓涓?#29761;呴鑰?#37737;虹被 class Decorator:public Cake { protected: Cake *pCake; public: Decorator(Cake*pc):pCake(pc){} }; //涓涓叿浣?#37928;勮?#21620;鍣? class FlowerDecorator:public Decorator { public: FlowerDecorator(Cake*pc):Decorator(pc){} virtual string getName()const { string decName="瑁呴杩?#38010;?#37928;?; decName+=pCake->getName(); return decName; } }; int main() { cout<< FlowerDecorator( &FlowerDecorator( &CheeseCake() )) .getName().c_str() <<endl; return 0; }

浠?#28000;爜涓?#28051;嶉毦鐪嬪嚭绋嬪簭鐨勮緭鍑?#32513;?#37835;勫簲璇?#37828;?#8220;瑁呴杩?#38010;?#37928;勮?#21620;杩?#38010;?#37928;勫?#33333;?#30789;泲绯?#8221;?#32029;浜嬪疄涔?#37928;勭濡?#23005;?#38171;?#28000;庤?#21620;鍣?#37928;?#28003;跨敤鏍煎紡?#28533;鐪?/span>FlowerDecorator(&FlowerDecorator(&CheeseCake()))?#24143;鍙?#28051;涓嬪?#26495;潃浜?/span>~

澶嶅埗浠爜
#pragma once
#include <iostream>
using namespace std;
//Cake鍏叡鍩虹被?#32029;?#24385;渚涜?#21620;鑰?#37724;岃瑁呴?#25198;墿鐨勭粺涓鎺?#37721;?/span>
class Cake
{
public:
    virtual string getName()const=0;
};

//涓涓叿浣?#37928;勮泲绯?/span>
class CheeseCake:public Cake
{
public:
    virtual string getName()const
    {
        return string("濂舵?#30789;泲绯?/span>");
    }
};

//涓涓?#29761;呴鑰?#37737;虹被
class Decorator:public Cake
{
protected:
    Cake &pCake;
public:
    Decorator(Cake&pc):pCake(pc){}
};

//涓涓叿浣?#37928;勮?#21620;鍣?/span>
class FlowerDecorator:public Decorator
{
public:
    FlowerDecorator(Cake&pc):Decorator(pc){}
    virtual string getName()const
    {
        string decName="瑁呴杩?#38010;?#37928;?/span>";
        decName+=pCake.getName();
        return decName;
    }
};
int main()
{
    cout<<
        FlowerDecorator(
            FlowerDecorator(
                CheeseCake()
        ))
        .getName().c_str()
        <<endl;
    return 0;
}
澶嶅埗浠爜

淇?#37824;?#37722;?#37928;?#28000;?#37934;佺湅璧锋潵鐨勭?#27967;“椤虹溂浜?#8221;銆傚洜涓?#29835;冪敤鐨勬椂鍊欐垜浠?#28051;?#37922;?#37712;嶅啓?#20549;涓?#37930;嬬潃鍒?#37813;?#37928;?#37721;?#37734;板潃杩愮畻绗?#27996;嗭紝?#21159;鍚庢垜浠弧鎬娆枩鐨?#37813;?#29723;?#27996;?#32459;嬪簭?#32029;杈?#37713;?#32513;?#37835;?#28051;?#38171;?#8220;瑁呴杩?#38010;?#37928;勫?#33333;?#30789;泲绯?#8221;锛?#28003;犳垜鐨勭涓鍙嶅簲鍏垚鏄?#29785;夊緱蹇?#27996;?#28598;氫慨楗?#28051;娆?#27996;嗭紝浣?#37828;垜浠?#29825;?#37930;?#37928;勬?#29025;浠爜?#32029;鍙戠幇鐨勭涓鍒?#38318;?#37828;?#32471;?#37722;堥?#26440;?#37928;?#8230;…

鍙?#29722;?#37813;?#29723;?#27996;?#28051;娆紝?#27932;姝?#28751;戣緭鍑?#28051;娆?#8220;瑁呴杩?#38010;?#37928;?#8221;涓嶈冻涓哄銆?#28003;?#37828;?#28003;?#37812;戣偗瀹氬?#34249;涓轰粈涔?#28028;氬?#25123;緭鍑?#28051;娆憿锛?/span>

?#26882;璋冪敤鐨?#37828;?#28598;嶅埗鏋?#38315;?#37713;芥暟?#32029;鑰?#28051;?#37828;畾涔夊鐨?#37835;?#38315;?#37713;芥暟锛堣?#30028;劧瀛愮被FlowerDecorator鐨勫?#24878;被?#32029;浣?#37828;?#32514;?#29831;?#37731;?#28028;?#38007;?#37716;渶浣?#37718;?#38320;嶅?#33445;暟鍙傛暟?#34987;鍨?#38171;?#38171;佺敱浜?#28598;嶅埗鏋?#38315;?#37713;芥暟鍊?#37720;?#22959;?#37720;熸牱鐨勬嫹璐?#37713;?#28051;涓?#28725;硅薄?#32029;鎵?#20114;鍙?#38003;藉?#23678;垚涓娆?#29761;呴鍣?#29761;呴銆?#38344;?#29999;稿?#23680;鐨勮閲?#38171;佸洜姝垜浠?#37721;互鑷?#23480;?#38322;嶅啓澶嶅埗鏋?#38315;?#37713;芥暟?#28533;瀹屾垚?#22428;浠?#37928;勮?#21620;?#26495;姛?#20824;?#32029;?#32342;閲屽厛蹇界鍘?#37832;?#37928;勫?#30789;薄澶嶅埗鍔熻兘浜?#37510;?#32514;?#29831;?#37731;?#28051;烘垜浠?#37922;熸垚鐨勫?#23941;埗鏋?#38315;?#37713;芥暟搴?#29831;?#37828;?#38171;?/span>

const FlowerDecorator&pc):Decorator(pc.pCake){}

鑰屾垜浠?#25652;?#29831;?#28751;?#37721;傛暟鐪?#28003;?#28051;涓?/span>Cake

FlowerDecorator(const FlowerDecorator&pc):Decorator(const_cast<FlowerDecorator&>(pc)){}

鍚屾牱?#32029;鐢?#27996;?#37835;?#38315;?#37713;芥暟鍒?#28654;?#37718;?#27996;嗗?#34425;被?#32029;鎵?#20114;鍩虹被鐨勫?#23941;埗鏋?#38315;?#28052;熼渶瑕?#38322;嶅啓锛?/span>

const Decorator&pc):pCake(const_cast<Decorator&>(pc)){}

鍗?#28003;?#28028;?#38315;?#37928;?#37721;傛暟鏄?/span>FlowerDecorator涓?/span>Decorator鍗?#23005;?#29882;熻釜?#32029;缁?#37835;?#28003;?#37721;戠?#29256;嫹璐?#37835;?#38315;?#37713;芥暟骞舵病鏈?#29722;?#29835;冪敤锛侀?#40515;?#25778;互涓?#37928;勫亣璁?#38318;?#38335;?#27996;?#37722;?#38171;熸垜鍙互纭畾鐨勫璇?#29831;?#38000;咃紝?#22428;浠互涓?#37928;勫亣璁?#38318;?#37828;?#23005;?#32429;?#37928;?#37510;?/span>

涓?#23033;傚?#32029;缁?#37722;?#37733;?#32475;?#38000;?#37928;勮璁猴紝鎴戠浜庢妸闂?#26864;?#37928;勫?#29111;洜閿佸畾浜?#8212;—缂?#29831;?#37731;?#28028;?#37718;?#38171;佹?#25123;?#22794;緱鐢?#28051;涓渶绠鍗?#37928;勪?#23338;瓙?#28533;璇?#37828;庤繖涓?#38338;?#26864;樺?#23941;?#22565;?#28051;嶈繃浜?#38171;?/span>

澶嶅埗浠爜

class A
{
public:
    A(int)
    {
        cout<<"鏋?#38315;燶n";
    }
    A(const A&)
    {
        cout<<"鎷?#29840;\n";
    }
};

int main()
{
    A(0);
    cout<<"------------------------\n";
    A(A(0));
    cout<<"------------------------\n";
    A(A(A(0)));
    cout<<"------------------------\n";
    A(A(A(A(0))));
    cout<<"------------------------\n";
    A(A(A(A(A(0)))));
    cout<<"------------------------\n";
    return 0;
}
澶嶅埗浠爜

?#32342;涓?#32480;鍗?#37928;勪?#23338;瓙缁?#37835;?#37812;?#29825;?#28598;?#28729;?#38318;藉緢鏄庣櫧?#32029;浣?#37828;?#28003;?#27996;?#38007;祴璇?#28051;涓嬪氨鍙兘瑕佹鐤戣嚜宸?#37928;勫垽鏂?#38003;藉姏浜嗭紝绋嬪簭杈?#37713;?#38171;?/span>

涓?#37928;勬祴璇?#32513;?#37835;滐紝?#27932;涓鸿繖涓?#32459;嬪簭鐨勮緭鍑?#37928;勭鍜岀紪璇?#37731;?#37929;稿叧锛?#28051;轰簡纭?#29825;?#37812;戠敤gcc-4.4.3

浼?#37718;?#37928;?#23011;?#26440;?#35120;?#25652;?#37510;傚洜姝垜浠?#37721;互寰楀嚭缁?#29825;猴紝?#34987;浼艰繖绉嶆棤鍚嶅?#30789;薄鐨?#37835;?#38315;?#38171;?#37832;?#37722;?#37928;?#37828;?#37816;夌収瑙勭煩?#28533;鐨?#38171;夛紝璋冪敤澶氬?#25118;鏋?#38315;?#37713;芥暟瑕佺湅缂?#29831;?#37731;?#37928;?#8220;鑴炬皵”浜?#37510;傚埌?#32342;閲岋紝涓嶇煡閬?#28003;犲寮?#37922;?#37721;傛暟鐨勬劅瑙夊浣?#38171;?/span>



sheng 2013-04-05 11:27 鍙戣璇勮
]]>
DLL涓?#28028;?#38315;扴TL鍙傛暟?#32029;vector瀵硅薄浣?#28051;dll鍙傛暟浼?#38315;掔瓑闂?#26864;?杞?http://www.9087120.com/cppopp/archive/2013/03/01/198152.htmlshengshengFri, 01 Mar 2013 05:58:00 GMThttp://www.9087120.com/cppopp/archive/2013/03/01/198152.htmlhttp://www.9087120.com/cppopp/comments/198152.htmlhttp://www.9087120.com/cppopp/archive/2013/03/01/198152.html#Feedback0http://www.9087120.com/cppopp/comments/commentRss/198152.htmlhttp://www.9087120.com/cppopp/services/trackbacks/198152.html 


STL璺钩鍙?#29835;冪敤浼氬?#34425;?#26495;緢澶氬?#20634;父?#32029;浣?#37721;互璇?#29831;?

STL浣跨敤妯?#37833;跨?#29112;垚?#32029;?#32139;?#22428;浠?#28003;跨敤妯?#37833;跨殑?#26882;鍊欙紝姣?#28051;涓狤XE?#32029;鍜DLL閮藉湪缂?#29831;?#37731;?#27996;?#37922;?#27996;?#38007;?#23480;?#37928;?#28000;爜?#32029;瀵?#38007;?#22959;?#37833;?#37813;浣跨敤鐨勯潤鎬佹垚鍛?#28051;嶅悓姝紝鎵?#20114;鍑虹?#29256;暟鎹?#28028;?#38315;?#37928;勫?#21229;闂?#26864;橈紝涓?#38344;?#37828;?#29831;?#32513;?#29785;?#38322;?#37510;?/strong>

鍘熷洜鍒嗘瀽锛?br style="margin: 0px; padding: 0px; " />涓鍙?#29831;?----濡?#37835;?#28000;?#28003;STL?#34987;浣跨敤浜?#38344;?#37804;?#37721;?#38322;?#38171;?#37827;?#29825;?#37828;?#37929;?#37818;?#26473;?#37828;?#38338;?#37818;?#28003;跨敤锛夛紝?#20549;涔堝氨涓?#29781;佸?#23941;啓鍑?#29882;?#37813;?#29723;?#37719;?#37711;?#29825;?#38338;?#28729;?#37928;?#28000;爜銆?nbsp;闄?#38344;?#28003;犺兘澶?#32429;畾涓?#28051;?#37716;?#37804;佸簱浣跨敤鐨?#38318;?#37828;?#37722;屾牱鐨凷TL?#30084;鐜帮紝姣?#28641;?#38318;?#28003;跨敤VC鍚?#28051;鐗?#37832;?#37928;凷TL?#32029;缂?#29831;?#38315;?#26916;?#28052;?#28051;?#29297;銆?#23534;虹?#22557;缓璁紝涓?#29781;?#37734;?#37716;?#37804;佸簱鎺?#37721;?#28051;?#28028;?#38315;扴TL瀹?#37731;?#38171;?#38171;?br style="margin: 0px; padding: 0px; " />
STL涓?#28051;?#30078;涓嶈?#34249;湪DLL闂?#28028;?#38315;掞紝浣?#28003;?#36423;呴褰?#25652;曟?#28852;?#20634;畠鐨勫唴閮疄鐜帮紝骞舵?#20634;緱涓轰綍浼氬嚭闂?#26864;?#37510;?br style="margin: 0px; padding: 0px; " />寰?#26462;?#37928;勮閲?#38171;?br style="margin: 0px; padding: 0px; " />http://support.microsoft.com/default.aspx?scid=kb%3ben-us%3b172396
寰?#26462;?#32513;?#37928;勮鍐?#37716;?#23049;?#38171;?br style="margin: 0px; padding: 0px; " />http://support.microsoft.com/default.aspx?scid=kb%3ben-us%3b168958

1銆佸井杞?#37928;勮閲?#38171;?br style="margin: 0px; padding: 0px; " />澶?#38318;?#37714;咰++?#29219;鍑嗗簱閲屾彁渚?#37928;勭被鐩?#37818;?#37812;?#38338;?#37818;?#37734;?#28003;跨敤浜?#38344;?#37804;?#37721;?#38322;?#37510;?#37922;?#27996;庤繖浜涚被鏄?#38315;?#26473;?#22959;?#37833;?#37813;?#28766;?#38000;屾潵鐨勶紝?#27932;姝?#23011;?#28051;?#37721;?#37813;?#29723;?#37828;犲儚锛堥氬父鏄?dll鎴?exe鏂?#28000;?#38171;夊氨浼氬瓨鍦?#28051;浠?#37721;?#28766;?#27996;?#38007;?#23480;?#37928;?#37510;佺?#27407;畾?#34987;鐨勯潤鎬佹暟鎹垚鍛?#37510;傚綋涓涓渶瑕?#29825;?#38338;繖浜?#38344;?#37804;佹垚鍛?#37928;勭被鏂规硶鎵?#29723;屾椂?#32029;瀹?#28003;跨敤鐨?#37828;?#8220;?#32342;涓?#37826;规硶鐨?#28000;?#37934;佸綋?#22688;鎵鍦?#37928;勯偅浠?#37721;?#37813;?#29723;?#37828;犲儚”閲?#37928;勯潤鎬佹垚鍛?#37721;?#38322;?#37510;?#37922;?#27996;?#28051;?#28000;?#37721;?#37813;?#29723;?#37828;犲儚鍚勮嚜鐨勯潤鎬佹暟鎹垚鍛樺苟鏈?#37722;屾?#32029;?#32342;涓?#29723;?#28051;哄氨鍙?#38003;藉鑷?#29825;?#38338;?#26473;濅?#23350;紝鎴?#38000;呮暟鎹?#37930;嬭?#38155;潵浼?#28052;?#28051;?#28598;辨?#26668;鐮村潖浜?#37510;?br style="margin: 0px; padding: 0px; " />
鍙兘涓?#28598;?#28610;芥?#20646;紝?#22428;涓?#28051;?#28186;嬪瓙锛氬亣濡傜被A<T>鏈?#28051;?#38344;?#37804;?#37721;?#38322;弇_s?#32029;?#20549;涔堝綋1.exe浣跨敤浜?.dll涓彁渚?#37928;勬煇涓A<int>瀵硅薄?#26882;?#32029;鐢?#27996;?#22959;?#37833;?#37813;?#28766;?#37832;?#37714;讹紝1.exe鍜?.dll涓?#28028;氬?#21975;埆瀛?#37734;?#38007;?#23480;?#37928;?#28051;浠界被闈?#37804;?#37721;?#38322;廇<int>.m_s銆?br style="margin: 0px; padding: 0px; " />?#32342;?#29297;?#32029;?#20131;濡?.exe涓?#28000;?.dll涓?#37721;栧緱浜?#28051;涓?#37928;勭被A<int>鐨勫疄渚嬪?#30789;薄a?#32029;?#20549;涔堝綋鍦?.exe涓?#37929;?#37818;?#29825;?#38338;產.m_s?#26882;?#32029;鍏跺疄璁?#38338;?#37928;?#37828;?1.exe涓?#37928;勫搴?#37815;?#29840;?#38171;堟纭?#37807;?#37712;?#25652;?#29831;?#37828;?#29825;?#38338;?#27996;?.dll涓?#37928;a.m_s锛?#37510;傝繖?#29297;?#27688;鍙?#38003;藉鑷撮潪娉?#29825;?#38338;?#37510;佸簲?#32139;鏀?#37721;?#37928;勬暟鎹病鏈夋敼鍙?#37510;?#28051;嶅簲鏀?#37721;?#37928;勬暟鎹?#29722;?#38335;?#29831;?#37734;版洿鏀圭瓑寮傚父鎯?#35120;?#37510;?br style="margin: 0px; padding: 0px; " />
鍘?#37826;?#38171;?br style="margin: 0px; padding: 0px; " />Most classes in the Standard C++ Libraries use static data members directly or indirectly. Since these classes are generated through template instantiation, each executable image (usually with DLL or EXE file name extensions) will contain its own copy of the static data member for a given class. When a method of the class that requires the static data member is executed, it uses the static data member in the executable image in which the method code resides. Since the static data members in the executable images are not in sync, this action could result in an access violation or data may appear to be lost or corrupted.

1銆佷繚璇佽?#21228;簮鐨勫垎閰?鍒?#38340;搷浣滃?#22317;瓑骞?#28598;勪簬鍚?#28051;涓?#37813;?#29723;?#37719;?#37711;?#38171;?br style="margin: 0px; padding: 0px; " />   姣?#28641;傦紝鍙互鎶婅繖浜涙搷浣?#38171;?#37718;呮嫭鏋?#38315;?鏋?#37835;勫?#33445;暟銆佹煇浜涘鍣?#38007;?#37716;?#37813;?#28729;箋?#32342;涓渶瑕佺壒鍒?#23049;剰}?#26882;鐨勫唴瀛樺?#23941;垎閰嶇瓑锛?#38341;愯?#24531;埌鎺?#37721;?#37713;芥暟閲岄潰銆?#37817;?#37721;?#29831;?#29831;?#38171;氬閲?#28051;?#29781;佺洿鎺?#28000;巇ll涓?#26440;?#37713;簊tl瀵硅薄锛涘鏋?#28051;?#30078;瑕?#26440;?#37713;猴紝缁?#28729;冨姞涓?#28051;?#30512;鍖呰?#21635;紝?#21159;鍚?#26440;?#37713;鸿繖涓?#37718;呰?#21614;帴鍙?#38000;?#28051;?#37828;?#37720;熷?#23339;帴鍙?#37510;?br style="margin: 0px; padding: 0px; " />
2銆佷繚璇?#37813;鏈?#37928;?#37813;?#29723;?#37719;?#37711;?#28003;跨敤鍚屾牱鐗?#37832;?#37928;凷TL杩?#29723;屽簱銆?br style="margin: 0px; padding: 0px; " />   姣?#28641;傦紝鍏?#38318;?#28003;跨敤release?#31793;鎴debug?#31793;?#32029;鍚垯涓?#28051;?#37813;?#29723;?#37719;?#37711;?#37813;?#28766;?#37713;烘潵鐨凷TL?#34987;鐨勫唴瀛樺?#20904;眬?#27688;鍙兘浼?#28051;?#28051;?#29297;銆?br style="margin: 0px; padding: 0px; " />
鍙?#29781;?#29825;?#28003;?#37711;抽敭?#27688;鏄?#38171;?span style="margin: 0px; padding: 0px; ">濡?#37835;?#28000;?#28003;STL?#34987;浣跨敤浜?#38344;?#37804;?#37721;?#38322;?#38171;?#37827;?#29825;?#37828;?#37929;?#37818;?#26473;?#37828;?#38338;?#37818;?#28003;跨敤锛夛紝?#20549;涔堝氨涓?#29781;佸?#23941;啓鍑?#29882;?#37813;?#29723;?#37719;?#37711;?#29825;?#38338;?#28729;?#37928;?#28000;爜銆?br style="margin: 0px; padding: 0px; " />
瑙?#37712;?#37826;规硶锛?br style="margin: 0px; padding: 0px; " />1. 涓涓?#37721;互鑰冭檻鐨?#37826;规
姣?#28641;?#37832;?#28051;?#28051;?#37716;?#37804;佸簱L1鍜孡2?#32029;L2?#28214;瑕佷慨鏀筁1涓?#37928;?#28051;涓猰ap?#32029;?#20549;涔堟垜鍦L1涓?#29825;?#32515;?#28641;?#28051;嬫帴鍙?br style="margin: 0px; padding: 0px; " />int modify_map(int key, int new_value);
濡?#37835;滈渶瑕佹寚?#30078;“?#28999;涓涓猰ap”?#32029;?#22447;鍙互鑰冭檻?#30084;鐜?#28051;绉嶇被浼?#27996;?#37721;?#37836;?#37928;?#37826;瑰紡?#32029;姣?#28641;?#37721;互浼?#38315;?#28051;涓狣WORD
涓嶈繃?#32342;涓狣WORD鏀?#37928;?#37828;?#28051;涓?#37734;板潃

?#20549;涔modify_map?#27688;鍙互?#32342;?#29297;?#30084;鐜?#38171;?br style="margin: 0px; padding: 0px; " />int modify_map(DWORD map_handle, int key, int new_value)
{
    std::map<int, int>& themap = *(std::map<int, int>*)map_handle;
    themap[key] = new_value;
}

map_handle鐨勫?#28052;?#26851;?#37711;?#37922;盠1“鍛?#29831;?#8221;L2:
DWORD get_map_handle();

L2鍙互?#32342;?#29297;璋冪敤:
DWORD h = get_map_handle();
modify_map(h, 1, 2);

2. 鍔?#37711;?#28051;涓?#26864;?#28598;?#37928;勫?#20646;紝?#27688;鍙互瑙?#37712;?#38338;?#26864;?#37510;?#37813;?#20114;?#32029;浣犻渶瑕佸皢浣?#37928;Map鍖呰鍦dll?#21812;閮紝鑰?#28051;?#37828;?#29825;?#28729;?#37713;虹幇鍦?#37818;?#37721;綋涓?#37510;傚姩鎬佸簱鐨?#37818;?#37721;秺绠鍗曡?#23106;?#26020;紝涓嶅?#34249;幓浼?#28598;?#26473;?#28598;嶆潅鐨?#28051;?#28051;?#37828;?#38007;崇悊鍚嶈锛?#38171;?/p>

 

鍦?#37716;?#37804;佽繛鎺簱寮鍙?#28051;?#29781;佺壒鍒?#23049;?#37808;忓唴瀛?#37928;勫垎閰?#28051;?#38322;婃斁闂?#26864;橈紝绋?#28051;嶆敞鎰忥紝鏋?#37721;兘閫犳垚?#21812;瀛?#23049;勬紡?#32029;浠?#38000;?#29825;?#38338;?#37713;洪敊銆備?#23338;鍦煇DLL涓?#28699;?#37734;繖?#29297;涓娈?#28000;爜锛?br style="margin: 0px; padding: 0px; " />
extent "C" __declspec(dllexport) 
void ExtractFileName( const std::string& path //!< Input path and filename.
, std::string& fname //!< Extracted filename with extension.
)
{
std::string::size_type startPos = path.find_last_of('\\');
fname.assign(path.begin() startPos 1, path.end() );
}

鍦DLL涓?#28003;跨敤STL瀵硅薄std::string?#32029;骞?#28051;?#37734;?#37711;?#28051;?#37824;?#37721;std::string鐨勫唴瀹癸紝鍗?#37721;戠敓浜嗗唴瀛?#37928;?#38322;嶅垎閰?#38338;?#26864;??#23266;鍦EXE涓?#29835;冪敤璇?#37713;芥暟浼氬?#34425;?#26495;唴瀛樿闂?#38338;?#26864;?#37510;?span style="margin: 0px; padding: 0px; color: #ff3333; ">涓?#29781;?#37828;?#38171;氬洜涓篋LL鍜孍XE鐨勫唴瀛?#37714;?#38320;嶆柟?#32033;涓嶅悓?#32029;DLL涓?#37928;勫垎閰?#37928;勫唴瀛?#28051;嶈?#34249;湪EXE涓?#23005;?#32429;?#38322;婃斁鎺?#37510;?br style="margin: 0px; padding: 0px; " />
瑙?#37712;宠繖涓闂?#26864;?#37928;?#38315;?#23536;勫涓?#38171;?br style="margin: 0px; padding: 0px; " />涓鑸?#37807;?#37712;?#28051;?#38171;氭?#21227;缓DLL蹇呴閬?#23536;?span style="margin: 0px; padding: 0px; color: #ff3333; ">璋?#37714;?#38320;嶅氨鐢辫皝閲婃斁鐨?/span>鍘熷垯?#32029;渚嬪?#20400;OM鐨勮鍐?#37826;规锛?#37714;?#37922;?#23534;?#37922;?#29825;暟锛夛紝瀵硅薄鐨勫?#28056;缓锛QueryInterface锛?#28051;?#38322;婃?#24807;鍦COM缁?#28000;跺唴閮?#28729;屾垚銆?#37734;?#32510;疌 鐜?#28583;?#28051;嬶紝鍙互?#32226;瀹?#37828;?#37928;勫疄鐜扮被浼?#37826;规銆?/p>


鍦?#25652;?#37922;STL鐨?#37807;?#37712;?#28051;嬶紝寰堥毦浣跨敤涓?#26473;?#37826;规?#22559;潵瑙?#37712;I紝?#27932;姝?#36423;呴鍙?#26440;熻?#23106;?#21238;紝閫?#23536;?#37832;変簩锛?br style="margin: 0px; padding: 0px; " />1銆?#38007;?#23480;?#37712;欏唴瀛?#37714;?#38320;嶅櫒鏇?#28000;STL涓?#37928;勯?#27199;鍒?#38320;嶅櫒銆?br style="margin: 0px; padding: 0px; " />2銆?#28003;跨敤STLport鏇?#28000;?#32495;?#32513;?#37928;勬爣鍑嗗簱銆?br style="margin: 0px; padding: 0px; " />
鍏跺疄?#32029;涓?#26473;?#38338;?#26864;?#37734;VC7鍙婁互鍚庣増鏈?#28051;紝宸?#23536;楀埌瑙?#37712;I紝娉剰DLL宸?#32459;嬪拰璋冪敤鐨勫伐绋?#28051;?#30078;瑕?#28003;跨敤澶?#32510;跨?#23142;LL?#31793;?#32029;?#27688;涓?#28028;氬?#25120;?#29111;唴瀛樿闂?#38338;?#26864;?#37510;?/p>

 

 

涓涓緢濂?#37804;?#37928;?#38338;?#26864;?#38171;欴LL涓?#28003;跨敤std::string浣?#28051;?#37721;傛暟缁?#37835;?#37713;洪敊

?#32342;娈垫椂闂?鍦?#23480;?#32459;?#28051;?#28751;?#28051;浜涘姛鑳藉?#20349;?#21614;垚鍔?#37804;佸簱,?#28214;瑕?#28003;跨敤鍔?#37804;佸簱鎺?#37721;?#37928;勬椂鍊?浣跨敤浜?span style="margin: 0px; padding: 0px; ">STL鐨?#28051;浜涚被鍨?#28003;?#28051;?#37721;傛暟.

姣?#37826;string,vector,list.浣?#37828;?#37734;?#28003;跨敤鎺?#37721;?#37928;勬椂鍊?
  1. class exportClass
  2. {
  3.      bool dll_funcation(string &str);
  4. };
澶嶅埗浠爜
//涓?#38344;繖涓被鍙?#37828;?#28051;涓?#35120;紡?#32029;?#21503;浣撳唴瀹?#28051;嶅啓鍑烘潵浜??#32342;涓被琚?#28725;?#37713;?br style="margin: 0px; padding: 0px; " />
?#32139;?#22428;鍦?#28003;跨敤?#32342;涓簱鐨勬椂鍊??#32342;?#29297;鍐?#28000;爜:
  1. string str="":
  2. exportClass tmp;
  3. tmp.dll_function(str);
澶嶅埗浠爜
?#32342;涓?#37713;芥暟?#20824;?#22426;鍔?#29835;冪敤.浣?#37828;?#37734;?#37713;芥暟閲岄潰浼?#32513;欒繖涓暟缁勯?#21227;?濡?#37835;滃瓧绗?#28051;?#28598;暱,?#27688;浼氬?#27946;敊.鍑芥暟璋冪敤?#20824;?#22426;鍔?浣?#37828;?#28051;鏃str璧勬?#24880;渶瑕?#38322;婃斁鐨勬椂鍊?璧勬?#24876;氨涓嶈兘閲婃斁浜??#24385;绀?#38322;婃斁浜嗛敊璇?#37928;勫唴瀛樼闂?

涓?#20579;涓?#20579;鍙?#37818;夎繖涓?#37713;芥暟鐨?#28000;爜.?#28214;鍚庡氨鍓?#28051;?br style="margin: 0px; padding: 0px; " />
str="qadasdasdasdsafsafas";

杩?#37828;?#37713;洪敊璇?

濡?#37835;?#37824;规垚?#32226;?#29037;鐨勫瓧绗?#28051;??#27688;涓?#28028;氬?#27946;敊璇?
鍦繖涓椂鍊?鍙?#38003;藉皾璇?#29825;?#28051;?#37828;瓧绗?#28051;?#37928;勭闂?#28598;皬

?#28214;缁堟垜淇?#37824;规垚?#32342;?#29297;,閿?#29831;秷澶?#27996;?甯?#37832;?#38335;?#29831;?#37930;?#37928;?#37828;繖涓?#23534;曡捣鐨?div style="margin: 0px; ">
  1. string str="":

  2. str.resize(1000);

  3. exportClass tmp;

  4. tmp.dll_function(str);

 

浠?#28598;?#37712;?#32459;嬪簭鐨勬椂鍊?#29781;佺粰涓涓?#22959;?#37735;?#37928;dll浼?#38315;?#28051;涓?#37721;傛暟?#32029;鐢?#27996;?#37721;傛暟?#26271;閲?#37828;?#37721;?#37721;?#37928;勶紝?#27932;姝?#29825;?#29825;垚浜唙ector<string>?#34987;鍨嬶紝浣?#29835;?#29831;曡繃绋?#28051;?#37721;戠幇鍦exe涓?#37928;?#37721;傛暟浼?#38315;掑埌dll涓?#37928;勫?#33445;暟鍚庯紝vector鍙樻垚绌?#37928;勶紝鏀规垚浼?#23534;?#37922;被鍨?#37722;庯紝vector绔熺劧鍙樺?#26944;緢澶紝骞?#28051;?#37828;?#37827;犳剰涔?#37928;?#37721;傛暟銆?/p>

瀵?#27996;庤繖涓?#38338;?#26864;橈紝涓?#32457;嶅姙娉?#38171;?/p>

1.浼?#38315;抳ector鎸?#38333;?/p>

2.浼?#38315;抍onst vector<TYPE>銆?/p>

绌?#37711;跺?#29111;洜锛?/p>

鏄洜涓簐ector鍦exe鍜宒ll涔?#38338;?#28028;?#38315;?#37928;勬椂鍊欙紝鐢?#27996;?#37734;dll?#21812;鍙?#38003;藉vector鎻?#37711;暟鎹紝鑰岃繖娈靛唴瀛?#37828;?#37734;dll閲岄潰鍒?#38320;?#37928;勶紝exe鏃?#23049;曠煡閬?#28641;?#28003;?#38322;婃?#24807;唴瀛橈紝浠?#38000;屽鑷?#38338;?#26864;?#37510;?#38000;屾?#35268;垚const?#34987;鍨?#37722;庯紝缂?#29831;?#37731;?#28186;跨煡閬dll閲?#28051;?#28028;氭敼鍙榲ector?#32029;浠?#38000;?#28051;?#28028;氬?#27946;敊銆?/p>

鎴?#38000;?#37721;互璇磋繖鏄?cross-DLL problem."锛圱his problem crops up when an object is created using new in one dynamically linked library (DLL) but is deleted in a different DLL锛?#37928;?#28051;绉嶅惂銆?/p>

瀵?#27996;STL?#32029;鍦DLL涓?#28003;跨敤鐨勬椂鍊欙紝寰寰瀛?#37734;繖浜?#38338;?#26864;橈紝鍦?#32515;戠粶涓婃?#28360;浜?#28051;嬶紝?#32342;浜?#38318;?#37828;?#29781;佸钩?#26882;浣跨敤STL鐨勬椂鍊?#23049;剰鐨?#37510;?/p>

***************************************************************************************************************

寮?#37922;?a href="http://www.hellocpp.net/Articles/Article/714.aspx" style="margin: 0px; padding: 0px; color: #50618d; text-decoration: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; ">http://www.hellocpp.net/Articles/Article/714.aspx

?#32139;template 閬?#38316;囧埌dynamic link ?#26882;鍊? ?#32226;澶氭椂鍊?#37719;?#37828;?#28051;鍦?#37805;舵.
鐜?#37734;潵璇?#29831;?#28051;閮?#37714;嗘垜宸?#32513;忕?#26495;埌杩?#37928;?#38338;?#26864;? 闂?#26864;?#28051;?#29781;侀涓?#37734;唴瀛?#37714;?#38320;?#28051;?
1> 
      鎷縎TL?#28533;璇? 鑷?#23480;?#37712;?#22959;?#37833;跨殑?#26882;鍊?寰堥毦鍏嶅氨鐢埌stl. stl鐨?#28000;爜閮藉湪澶?#37826;?#28000;?#38322;? ?#20549;涔?#29723;?#32448;虹潃?#21812;瀛?#37714;?#38320;?#37928;?#28000;爜.鍙?#37832;?#37718;?#37722;?#27996;嗗畠鐨刢pp 缂?#29831;?#37928;勬椂鍊欐墠浼氳鍐?#28729;氭槸浣跨敤?#31880;涔堟牱鐨勫唴瀛?#37714;?#38320;?#28000;爜. 鑰冭檻涓涓? ?#32139;浣犲鏄?#27996;?#28051;涓獀ector<> . 骞?#37814;婅繖涓獀ector<>浜?#32513;?#28051;涓?dll閲?#37928;?#28000;爜?#28533;鐢? 鐢?#28729;?#37722;? 鍦?#28003;?#37928;?#32459;嬪簭閲岃閲婃斁浜?    ?#20549;涔?#28641;?#37835;?#28003;?鍦dll閲屽線vector閲宨nsert浜?#28051;浜?#28051;滆. ?#20549;涔堣繖涓椂鍊檌nsert 鍙戠敓鐨勫唴瀛?#37714;?#38320;?#37928;?#28000;爜鏄?#28766;?#27996;巇ll鐨? 浣?#28051;嶇煡閬繖涓猟ll鐨勫唴瀛?#37714;?#38320;?#37828;粈涔? 鏄?#37714;?#38320;嶅湪鍝?#38322;?#37928;? 鑰岃繖涓椂鍊?閲婃?#40515;偅淇?#37928;勫姩浣?#37719;?#28051;嶅湪dll閲?....鍚屾椂. 浣?#37922;?#38007;?#37827;?#23049;曚繚璇佺紪璇慸ll鐨勯偅涓?#28729;?#28028;?#28003;跨敤鐨剆tl鐗?#37832;?#37724;?#28003;?#37828;?#28729;屽叏涓?#29297;鐨?.>
      濡?#23005;?#29831;存潵, 绋嬪簭crash鎺?#37828;?#28598;?#32513;?#37734;?#28052;?#37928;?... 
      瀵?#32475;? 鍗?#28051;?#37714;?#37714;?#37814;?#28003;?#37928;剆tl 瀹?#37731;?妯?#37833;?#28729;?#37731;?#37734;?dll 闂?#28028;犳潵浼犲幓 . 璁?#28003;string涔?#37828;?...

2> 
     浣?#37734;dll鐨勬煇涓被閲屽鏄?#27996;?#28051;涓獀ector涔嬬被鐨勫鍣? 鑰屾病鏈?#37828;惧紡鐨勫啓?#32342;涓被鐨?#37835;?#38315;?#37724;?#37835;?#37835;勫?#33445;暟. ?#20549;涔堥棶棰?#37721;堟潵浜?
     浣犺繖涓被?#20567;瀹氭?#22795;搷浣滆繖vector鐨勫?#33445;暟. ?#20549;涔堣繖浜涘?#33445;暟浼?#29825;vecoter<>鐢熸垚浠爜. ?#32342;浜?#28000;爜鍦繖涓猟ll閲?#38318;?#37828;?#28051;鑷?#37928;? 浣?#37828;?#37714;?#36423;?#27996;?浣犳病鏈?#37712;?#37835;?#37835;勫?#33445;暟...... 濡?#37835;滆繖涓椂鍊? 鍒?#27996;?#37734;?#28598;?#38344;?#28601;?#37828;?#27996;?#28051;涓繖?#29297;鐨勭被.?#21159;鍚庤?#20906;敤?#32342;涓被鐨勫?#33445;暟?#25655;浣?#27996;嗚繖涓獀ector( ?#32139;?#21159;浣跨敤鑰呭苟涓嶇煡閬撲粈涔堟椂鍊欐搷浣?#27996;唙ector) . 瀹冪敤瀹?#27996;嗚繖涓被?#20114;鍚? ?#34987;琚?#38322;婃斁鎺変簡. 缂?#29831;?#37731;緢璐?#29840;?#37928;?#28051;哄?#20906;?#29112;垚浜?#28051;浠?#37835;?#37835;勫?#33445;暟鐨?#28000;爜...... 鍚?#28610;?#27996;??#32342;浠?#28000;?#37934;佸苟涓?#37828;?#37734;?dll閲?... . 浜嬫儏浜?#37828;?#37721;?#37724;?>閲?#37928;?#28051;?#29297;浜?... crash ......(鍙兘杩?#28028;?#28028;撮?#24533;潃杩疯尗.....)
     瀵?#32475;? 璁板緱dll閲屾瘡涓被,鍝?#37804;曞紡鏋?#38315;?#37835;?#37835;勫?#33445;暟?#32033;绌?#37928;? 涔?#29781;佸?#27407;埌cpp閲屽幓. ?#31880;涔堥兘涓嶅啓涔熷紡?#32226;绯?#32495;?#37928;?....鍚屾椂,?#27967;瑕佹妸浠?#28003;?#37724;屽唴瀛樻搷浣?#37832;?#37711;?#37928;勫?#33445;暟鍐欏埌 .cpp 閲?..

3> 
    ?#20114;涓?#28051;?#28051;?#38338;?#26864;?#28028;?#28052;?#38318;?#37828;?#23011;?#26440;?#28729;?#37828;?#37928;?----鍙?#29781;佹妸浠爜閮藉?#27407;埌cpp閲屽幓, 涓?#29781;佺敤stl瀹?#37731;?#28028;犳潵浼犲?#35826;氨鍙互浜?
   ?#20549;涔?#32471;?#28051;?#28051;?#38338;?#26864;樺氨瑕侀?#33636;鐨勫.
   濡?#37835;?#28003;?#38007;?#23480;?#37712;?#27996;?#28051;涓?#22959;?#37833;? ?#32342;涓?#22959;?#37833;跨敤浜stl 瀹?#37731;?.........
   ?#32342;涓椂鍊?#28003;?#29831;?#37804;?#28052;堝?#28850;憿?
銆鏄剧劧浣?#37827;?#23049;?#37814;?#37724;屽唴瀛?#37714;?#38320;?#37929;稿叧鐨勫?#33445;暟閮藉?#27407;埌.cpp閲屽幓 . template鐨?#28000;爜閮藉?#21620;鏀惧埌header file閲?....
   瀵?#32475;? 瑙?#37712;宠繖涓?#38338;?#26864;?#37928;勫熀鏈?#37707;氭硶鏄?#37707;?#28051;涓猻tl ?#21812;瀛?#37714;?#38320;嶅櫒 , 寮?#37714;?#37814;婅繖涓?#22959;?#37833;?#38322;屽?#23677;唴瀛?#37714;?#38320;?#37929;稿叧鐨?#37824;惧埌涓涓?cpp閲屽幓.?#32342;涓椂鍊?#32514;?#29831;戣繖涓猚pp?#27688;浼氭?#23106;唴瀛?#37714;?#38320;?#28000;?#37934;佸?#21700;?#27692;湪涓涓?#37734;?#37826;? 瑕?#28052;?#37828;痙ll. 瑕?#28052;?#37828;痚xe閲?..

妯?#37833;?鍔?#37804;侀摼鎺簱鐨?#28003;跨敤闂?#26864;樿?#27194;緢澶? 瑕?#37719;?#28051;囩暀蹇冭繖涓?#38340;?#38339;?#38316;嶅湴鐨?#28051;滆?#22446;

***************************************************************************************************************************

寰?#26462;?#37711;?#27996;庤繖?#34987;闂?#26864;?#37928;勮閲?#38171;?/p>

You may experience an access violation when you access an STL object through a pointer or reference in a different DLL or EXE

http://support.microsoft.com/default.aspx?scid=KB;en-us;q172396

How to export an instantiation of a Standard Template Library (STL) class and a class that contains a data member that is an STL object

http://support.microsoft.com/default.aspx?scid=KB;en-us;q168958

 

 

 

鎬?#32513;?#38171;?/p>

?#29927;绗?#28051;?#37721;傛暟鐢char*?#32029;Vector鐢char**?#32029;

鍔?#37804;佸唴瀛樿?#20346;璁?#29835;佺敵璇?#29835;?#38322;婃斁鐨勫?#29111;垯銆?/div>
 


sheng 2013-03-01 13:58 鍙戣璇勮
]]> տ3
<center id="iceyg"><tr id="iceyg"></tr></center>
<noscript id="iceyg"></noscript>
<center id="iceyg"></center>
<noscript id="iceyg"></noscript>
<noscript id="iceyg"></noscript>
<center id="iceyg"><tr id="iceyg"></tr></center>
<noscript id="iceyg"></noscript>
<center id="iceyg"></center>
<noscript id="iceyg"></noscript>
<noscript id="iceyg"></noscript>