锘??xml version="1.0" encoding="utf-8" standalone="yes"?>少妇久久久久久被弄到高潮,国产精品女同久久久久电影院,中文字幕亚洲综合久久http://www.shnenglu.com/cpunion/category/320.htmlAS/C/C++/D/Java/JS/Python/Rubyzh-cnMon, 19 May 2008 13:00:17 GMTMon, 19 May 2008 13:00:17 GMT60[D璇█] D璇█鏁扮粍http://www.shnenglu.com/cpunion/archive/2006/10/07/13418.htmlqieziqieziSat, 07 Oct 2006 08:21:00 GMThttp://www.shnenglu.com/cpunion/archive/2006/10/07/13418.htmlhttp://www.shnenglu.com/cpunion/comments/13418.htmlhttp://www.shnenglu.com/cpunion/archive/2006/10/07/13418.html#Feedback4http://www.shnenglu.com/cpunion/comments/commentRss/13418.htmlhttp://www.shnenglu.com/cpunion/services/trackbacks/13418.html
void聽main(){
聽聽聽聽
int[]聽c聽=聽[1,2,3];
聽聽聽聽
foreach(inout聽int聽i;聽c){
聽聽聽聽聽聽聽聽writef(
&i);
聽聽聽聽聽聽聽聽writef(
",聽");
聽聽聽聽}
聽聽聽聽writefln(
"");

聽聽聽聽c.length聽
=2;
聽聽聽聽
foreach(inout聽int聽i;聽c){
聽聽聽聽聽聽聽聽writef(
&i);
聽聽聽聽聽聽聽聽writef(
",聽");
聽聽聽聽}
聽聽聽聽writefln(
"");


聽聽聽聽c.length聽
=3;
聽聽聽聽
foreach(inout聽int聽i;聽c){
聽聽聽聽聽聽聽聽writef(
&i);
聽聽聽聽聽聽聽聽writef(
",聽");
聽聽聽聽}
聽聽聽聽writefln(
"");

聽聽聽聽c.length聽
=4;
聽聽聽聽
foreach(inout聽int聽i;聽c){
聽聽聽聽聽聽聽聽writef(
&i);
聽聽聽聽聽聽聽聽writef(
",聽");
聽聽聽聽}
聽聽聽聽writefln(
"");
}


瀹冭緭鍑虹粨鏋滃涓嬶細

B7D19FB0, B7D19FB4, B7D19FB8,
B7D19FB0, B7D19FB4,
B7D19FB0, B7D19FB4, B7D19FB8,
B7D1CFA0, B7D1CFA4, B7D1CFA8, B7D1CFAC,

鍙互鐪嬪埌鍓?琛屽湴鍧鐩稿悓錛屽悗闈竴琛屽湴鍧涓嶅悓銆備負浠涔堬紵

D璇█鐨勬暟緇勫垎閰嶆槸鍐呭瓨绱у噾鐨勶紝褰撳噺灝忔暟緇勯暱搴﹀噺灝忔椂錛屽彧闇瑕佷慨鏀瑰垏鐗囧ぇ灝忚屼笉闇瑕侀噸鏂板垎閰嶃傚綋闀垮害鍙樺ぇ鏃訛紝涔熶細媯鏌ュ師鏉ョ殑緙撳啿鍖烘槸鍚﹀澶э紝浠ョ‘瀹氭槸鍚﹂渶瑕侀噸鏂板垎閰嶇┖闂淬傛敞鎰忕2嬈℃搷浣滄椂鎶婇暱搴︽仮澶嶄負鍘熸潵澶у皬鏃訛紝騫墮潪鐪熺殑鎭㈠浜嗗師鏉ョ殑鐘舵侊紝鍚庨潰闀垮嚭鏉ョ殑鍏冪礌浼氳鍒濆鍖栦負榛樿鍊箋?br />
鍐嶆潵鐪嬩竴涓細

void聽main(){
聽聽聽聽
int[]聽c聽=聽[1,2,3];
聽聽聽聽
int[]聽d聽=聽c;

聽聽聽聽
foreach(inout聽int聽i;聽c){
聽聽聽聽聽聽聽聽writef(
&i);
聽聽聽聽聽聽聽聽writef(
",聽");
聽聽聽聽}
聽聽聽聽writefln(
"");

聽聽聽聽
foreach(inout聽int聽i;聽d){
聽聽聽聽聽聽聽聽writef(
&i);
聽聽聽聽聽聽聽聽writef(
",聽");
聽聽聽聽}
聽聽聽聽writefln(
"");

聽聽聽聽d.length聽
=2;

聽聽聽聽
foreach(inout聽int聽i;聽c){
聽聽聽聽聽聽聽聽writef(
&i);
聽聽聽聽聽聽聽聽writef(
",聽");
聽聽聽聽}
聽聽聽聽writefln(
"");

聽聽聽聽
foreach(inout聽int聽i;聽d){
聽聽聽聽聽聽聽聽writef(
&i);
聽聽聽聽聽聽聽聽writef(
",聽");
聽聽聽聽}
聽聽聽聽writefln(
"");

聽聽聽聽d.length聽
=4;

聽聽聽聽
foreach(inout聽int聽i;聽c){
聽聽聽聽聽聽聽聽writef(
&i);
聽聽聽聽聽聽聽聽writef(
",聽");
聽聽聽聽}
聽聽聽聽writefln(
"");

聽聽聽聽
foreach(inout聽int聽i;聽d){
聽聽聽聽聽聽聽聽writef(
&i);
聽聽聽聽聽聽聽聽writef(
",聽");
聽聽聽聽}
聽聽聽聽writefln(
"");
}

鍦ㄦ墽琛宨nt[] d = c;浠ュ悗錛宒鐨勭‘鏄拰c鍏變韓浜嗗瓨鍌ㄥ尯銆備笉榪囧湪鏀瑰彉d鐨勯暱搴︿互鍚庯紝瀹冨氨鍜宑鍒嗛亾鎵暢浜嗐傛墍浠nt[] d = c涓嶈兘鐞嗚В涓篸鏄竴涓寚鍚慶鐨勫紩鐢紝瀹冨疄闄呬笂鍒涘緩浜嗕竴涓柊鐨勬暟緇勫璞★紝浣嗗茍涓嶆嫹璐濇暟緇勫厓绱狅紝瀹冨拰int[] d = c[0 .. length]鏄瓑浠風殑錛岄兘鏄暟緇勫垏鐗囨搷浣溿?br />
榪欎釜闂璁╂垜鍥版儜涓嶅凡銆傛瘮濡備綘鐢╟har[]琛ㄧず涓涓崟璇嶏紝鐢╟har[][]琛ㄧず涓琛岋紝char[][][]琛ㄧず澶氳銆傚浣曞紩鐢ㄨ繖涓崟璇嶏紵浣犲綋鐒跺彲浠ユ瘡嬈′嬌鐢╨ines[i][j]錛屼絾濡傛灉澶勭悊姝ラ寰堝錛岃繖浼氫笉浼氱湅璧鋒潵寰堝ご澶э紵

鐪嬩笂鍘誨簲璇ヨ繖鏍蜂嬌鐢細

char[][][]聽lines;
char[][]聽line聽=聽lines[0];
line.length聽
=聽line.length聽+1;
line[length聽
-1]聽=",";

鍙儨鏍規嵁鍓嶉潰鐨勭粨璁猴紝榪欏皢鏃犳硶褰卞搷鍒發ines銆傚鏋滄壘涓嶅埌涓涓紩鐢ㄧ被鍨嬫寚鍚戞暟緇勶紝鏈夋椂鍊欎嬌鐢ㄨ搗鏉ヨ繕鐪熸槸寰堥夯鐑︺傜湅璧鋒潵鎶奓ine/Word鍖呰鎴愮被鏄釜鍕夊己鍑戝悎鐨勪富鎰忋傘傘?img src ="http://www.shnenglu.com/cpunion/aggbug/13418.html" width = "1" height = "1" />

qiezi 2006-10-07 16:21 鍙戣〃璇勮
]]>
[D璇█] Array slicinghttp://www.shnenglu.com/cpunion/archive/2006/10/06/13393.htmlqieziqieziFri, 06 Oct 2006 01:35:00 GMThttp://www.shnenglu.com/cpunion/archive/2006/10/06/13393.htmlhttp://www.shnenglu.com/cpunion/comments/13393.htmlhttp://www.shnenglu.com/cpunion/archive/2006/10/06/13393.html#Feedback0http://www.shnenglu.com/cpunion/comments/commentRss/13393.htmlhttp://www.shnenglu.com/cpunion/services/trackbacks/13393.html
鎸囬拡鐨剆licing鎿嶄綔鍜屾暟緇剆licing璇剰鏄浉鍚岀殑銆?br />
閫氳繃slicing鐢熸垚D鏁扮粍錛屾瘮鍘熸潵鐩存帴浣跨敤鎸囬拡鐨勫ソ澶勬槸鍙互鏈夎竟鐣屾鏌ャ?br />
鏈榪戝垰濂界姱浜嗚繖涓敊璇紝鍦ㄤ嬌鐢╢reetype鏃訛紝render鍑烘潵鐨勪綅鍥炬暟鎹洿鎺ヤ嬌鐢╯licing鐢熸垚鏁扮粍淇濆瓨璧鋒潵銆傜敱浜巗licing騫朵笉澶嶅埗鏁版嵁錛岃繖鏍峰悗闈㈢殑render鎿嶄綔浼氳鐩栧墠闈㈢殑鏁版嵁錛屾墍浠ユ垜淇濆瓨鐨勬暟緇勫叾瀹為兘鎸囧悜鍚屼竴涓紦鍐插尯銆傚綋閲婃斁face瀵硅薄鏃訛紝緙撳啿鍖轟篃娌′簡錛屽啀璁塊棶鎭愭曡孌甸敊璇簡銆?br />
榪欎釜鏄疍鏂囨。涓槑紜弿榪頒簡鐨勶紝鎴戝嵈鑺變簡鐐規椂闂存墠鎺掗櫎榪欎釜閿欒錛屽啓涓嬫潵璁板綍涔嬶綖


qiezi 2006-10-06 09:35 鍙戣〃璇勮
]]>
[D璇█] DMD 0.168鍙戝竷http://www.shnenglu.com/cpunion/archive/2006/10/05/13362.htmlqieziqieziThu, 05 Oct 2006 01:23:00 GMThttp://www.shnenglu.com/cpunion/archive/2006/10/05/13362.htmlhttp://www.shnenglu.com/cpunion/comments/13362.htmlhttp://www.shnenglu.com/cpunion/archive/2006/10/05/13362.html#Feedback5http://www.shnenglu.com/cpunion/comments/commentRss/13362.htmlhttp://www.shnenglu.com/cpunion/services/trackbacks/13362.html1銆佺粰濮旀墭澧炲姞ptr灞炴э紝鎸囧悜濮旀墭鎵緇戝畾鐨勫璞°?br />榪欐槸涓涓娉曠硸錛宒g.ptr琚漿鍖栦負cast(void*)dg錛屽畠鍙兘浣滃彸鍊鹼紝鎵浠ラ櫎浜嗚兘璇誨彇瀹冧互澶栵紝鍦ㄨ娉曚笂紱佹瀵瑰畠璧嬪箋傝鎯蟲妸濮旀墭緇戝畾鍒頒笉鍚岀殑瀵硅薄錛屼綘鍙兘鑷繁瀹炵幇錛?br />
class聽Foo{
聽聽聽聽
int聽foo;
public:
聽聽聽聽
this(int聽foo){
聽聽聽聽聽聽聽聽
this.foo聽=聽foo;
聽聽聽聽}

聽聽聽聽
void聽bar(){
聽聽聽聽聽聽聽聽writefln(foo);
聽聽聽聽}
}

void聽main(){

聽聽聽聽alias聽
voiddelegate()聽DG;
聽聽聽聽DG聽dg聽
=&(new聽Foo(1)).bar;

聽聽聽聽Foo[
10]聽foos;
聽聽聽聽
foreach(int聽i,聽inout聽Foo聽foo;聽foos){
聽聽聽聽聽聽聽聽foo聽
=new聽Foo(i);
聽聽聽聽}

聽聽聽聽
void**聽ptr聽=聽cast(void**)&dg;
聽聽聽聽
foreach(Foo聽foo;聽foos){
聽聽聽聽聽聽聽聽
*ptr聽=聽cast(void*)foo;
聽聽聽聽聽聽聽聽dg();
聽聽聽聽}
}

榪欑鏂瑰紡涔熶笉鏄垜浠墍甯屾湜鐨勶紝涓鑸潵璇村鎵樼粦瀹氬埌澶氫釜瀵硅薄鏃訛紝鍥犱負鏄彇鍒版煇鎴愬憳鍑芥暟鎸囬拡錛屽啀榪涜緇戝畾銆傛瘮濡傛ā鎷熶竴涓狝ctiveSupport鎵鎵╁睍鐨勪竴涓猺uby.Array#map鐢ㄦ硶錛?br />
import聽std.stdio;

class聽Foo{
聽聽聽聽
int聽foo;
public:
聽聽聽聽
this(int聽foo){
聽聽聽聽聽聽聽聽
this.foo聽=聽foo;
聽聽聽聽}

聽聽聽聽
void聽bar(){
聽聽聽聽聽聽聽聽writefln(foo);
聽聽聽聽}
}

class聽Array(T){
聽聽聽聽
private:
聽聽聽聽T[]聽data;

聽聽聽聽
public:
聽聽聽聽
this(T[]聽data){
聽聽聽聽聽聽聽聽
this.data聽=聽data[0聽..聽length];
聽聽聽聽}

聽聽聽聽
void聽map(void聽function()聽func){
聽聽聽聽聽聽聽聽
voiddelegate()聽dg;
聽聽聽聽聽聽聽聽
void**聽funcPtr聽=聽cast(void**)&dg聽+1;
聽聽聽聽聽聽聽聽
*funcPtr聽=聽func;
聽聽聽聽聽聽聽聽
void**聽ptr聽=聽cast(void**)&dg;
聽聽聽聽聽聽聽聽
foreach(T聽v;聽data){
聽聽聽聽聽聽聽聽聽聽聽聽
*ptr聽=聽cast(void*)v;
聽聽聽聽聽聽聽聽聽聽聽聽dg();
聽聽聽聽聽聽聽聽}
聽聽聽聽}
}

void聽main(){
聽聽聽聽auto聽arr聽
=new聽Array!(Foo)([new聽Foo(1),聽new聽Foo(2),聽new聽Foo(3)]);
聽聽聽聽arr.map(
&Foo.bar);
}

鏄殑錛宒elegate鍐呴儴淇濆瓨浜?涓寚閽堬紝鎵浠ユ垜浠彲浠ュ鏄撳湴hack瀹冦?br />
[娉細涓婇潰鐨刴ain鍑芥暟涓暟緇勭洿鎺ラ噺璧嬬粰鏍堝璞′篃鏄繖涓増鏈腑鏂板鐨勫唴瀹癸紝鏄劇劧鍙兘鐢ㄤ簬static瀵硅薄鏄緢楦¤倠鐨勩傝繖閲岀畝鍗曞甫榪囦笉鎻愩俔

[娉細涓婇潰榪欎釜map鐨勬ā鎷熷茍涓嶆槸ActiveSupport鐨刴ap鎵╁睍鐨勫叏閮ㄧ敤閫旓紝閭d釜map榪樻槸鏀墮泦榪斿洖鍊鹼紝榪欓噷鍙紨紺鴻皟鐢ㄨ娉曘侫ctiveSupport涓墿灞曠殑map璋冪敤璇硶鏄痬ap(&:to_s)錛屽氨鍙互鏀墮泦鍒版暟緇勪腑鎵鏈夊厓绱犺皟鐢╰o_s鍚庣殑榪斿洖鍊箋俔

2銆佺粰鍐呭祵鍐呯殑瀹炰緥澧炲姞outer灞炴э紝鎸囧悜澶栧眰瀵硅薄銆?br />
import聽std.stdio;

class聽Outer{
聽聽聽聽
class聽Inner{}

聽聽聽聽
this(){
聽聽聽聽聽聽聽聽Inner聽inner聽
=new聽Inner;
聽聽聽聽聽聽聽聽inner.outer.foo();
聽聽聽聽}

聽聽聽聽
void聽foo(){
聽聽聽聽聽聽聽聽writefln(
"foo");
聽聽聽聽}
}

void聽main(){
聽聽聽聽Outer聽outer聽
=new聽Outer;
}

榪欎釜鐗規у彲鑳藉簲鐢ㄥ茍涓嶆槸寰堝箍鍚с?br />
3銆乵ixin澶氫釜鏋愭瀯鍑芥暟銆?br />
template聽A(){
聽聽聽聽
this(){
聽聽聽聽}
聽聽聽聽
~this(){
聽聽聽聽聽聽聽聽writefln(
"A::~A()");
聽聽聽聽}
}

template聽B(){
聽聽聽聽
~this(){
聽聽聽聽聽聽聽聽writefln(
"B::~B()");
聽聽聽聽}
}

class聽C{
聽聽聽聽mixin聽A;
聽聽聽聽mixin聽B;
}

void聽main(){
聽聽聽聽C聽c聽
=new聽C;
聽聽聽聽delete聽c;
}

榪欎簺鏋愭瀯鍑芥暟浼氬拰mixin鐩稿弽鐨勯『搴忔墽琛屻傛垜涓嶆槑鐧界殑鏄紝涓轟粈涔堜笉璁﹎ixin澶氫釜鏋勯犲嚱鏁幫紵涓轟綍涓嶈榪欎簺鏋勯犲嚱鏁版櫄浜庤mixin鐨勭被錛堜笂闈㈢殑C綾伙級鐨勬瀯閫犲嚱鏁幫紝騫舵寜mixin榪涙潵鐨勯『搴忔墽琛岋紵


qiezi 2006-10-05 09:23 鍙戣〃璇勮
]]>
[D璇█] DMD 0.167鍙戝竷http://www.shnenglu.com/cpunion/archive/2006/09/19/12721.htmlqieziqieziTue, 19 Sep 2006 12:16:00 GMThttp://www.shnenglu.com/cpunion/archive/2006/09/19/12721.htmlhttp://www.shnenglu.com/cpunion/comments/12721.htmlhttp://www.shnenglu.com/cpunion/archive/2006/09/19/12721.html#Feedback2http://www.shnenglu.com/cpunion/comments/commentRss/12721.htmlhttp://www.shnenglu.com/cpunion/services/trackbacks/12721.html
import聽std.stdio;

void聽main(){
聽聽{
聽聽聽聽static聽
int[]聽arr聽=聽[1,2,3,4,5];
聽聽聽聽writefln(typeid(typeof(arr[
0])));
聽聽聽聽writefln(arr);
聽聽}
聽聽{
聽聽聽聽static聽float[]聽arr聽
=聽[1f,1,3,4,5];
聽聽聽聽writefln(typeid(typeof(arr[
0])));
聽聽聽聽writefln(arr);
聽聽}
聽聽{
聽聽聽聽static聽char[][]聽arr聽
=聽["1","2","3","4","5"];
聽聽聽聽writefln(typeid(typeof(arr[
0])));
聽聽聽聽writefln(arr);
聽聽}
}

鏁扮粍綾誨瀷鐢辯1涓厓绱犵被鍨嬪喅瀹氾紝綾誨瀷涓嶅尮閰嶅皢浼氫駭鐢熺紪璇戦敊璇?br />
鎺ョ潃鏄緇存暟緇勶細

import聽std.stdio;

void聽main(){
聽聽static聽
int[][]聽arr聽=聽[[1,2,3,4],聽[4,5,6],聽[7,8]];
聽聽
foreach(int[]聽sub;聽arr){
聽聽聽聽
foreach(int聽i;聽sub){
聽聽聽聽聽聽writefln(i);
聽聽聽聽}
聽聽}
}


鍙︿竴涓壒鎬ф槸鏇村己鐨則ypedef銆傚師鏈夌殑typedef寮虹被鍨嬪湪鏌愪簺鎯呭喌涓嬩細浜х敓娣蜂貢銆?br />
涓嬮潰鐨勪唬鐮佹憳鑷?http://www.digitalmars.com/pnews/read.php?server=news.digitalmars.com&group=digitalmars.D.bugs&artnum=3843

import聽std.stdio;

typedef聽
int聽Int1;
typedef聽
int聽Int2;

void聽show(Int1聽v)聽{
聽聽聽聽聽writefln(
"Int1:聽%d",聽v);
}

void聽show(Int2聽v)聽{
聽聽聽聽聽writefln(
"Int2:聽%d",聽v);
}

void聽show(
int聽i)聽{
聽聽聽聽聽writefln(
"int:聽%d",聽i);
}

void聽show(long聽l)聽{
聽聽聽聽聽writefln(
"long:聽%d",聽l);
}

void聽main()聽{
聽聽聽聽聽Int1聽value1聽
=42;
聽聽聽聽聽Int2聽value2聽
=69;

聽聽聽聽聽show(value1聽
+聽value2);
聽聽聽聽聽show(value2聽
+聽value1);
聽聽聽聽聽show(
2*聽value1);
聽聽聽聽聽show(value1聽
*2);
聽聽聽聽聽show(value1聽
+聽value1);
聽聽聽聽聽show(value2聽
-聽value2);
聽聽聽聽聽show(value1聽
+2);
聽聽聽聽聽show(
3+聽value2);

聽聽聽聽聽long聽l聽
=23;
聽聽聽聽聽show(value1聽
+聽l);
聽聽聽聽聽show(l聽
+聽value2);

聽聽聽聽聽short聽s聽
=105;
聽聽聽聽聽show(s聽
+聽value1);
聽聽聽聽聽show(value2聽
+聽s);
}

濡備笂闈唬鐮佹墍紺恒倀ypedef瀹氫箟鍑烘潵鐨勭被鍨嬪拰鍘熸湁綾誨瀷鐨勭浉鍚屽艦寮忛噸杞藉嚱鏁板彲浠ュ叡瀛橈紝榪欏彲浠ュ畬鎴愭洿寮虹被鍨嬬殑閲嶈澆錛孋錛嬶紜鐨勯噸杞借繕涓嶈兘瀹炵幇榪欎釜銆?br />
榪欎釜寮虹被鍨嬬殑typedef濂藉儚鍘熸湰灝辨敮鎸侊紝澶ф鏄繍綆楃粨鏋滅被鍨嬫瘮杈冩ā緋娿?br />
濂藉鏄樉欏墊槗瑙佺殑銆傛瘮濡傛湁涓涓猅ime鍜孴imeInterval綾誨瀷錛屽畠鐢ㄦ潵琛ㄧず緇濆鏃墮棿鎴栫浉瀵規椂闂撮棿闅旓紱鍙︽湁涓涓緭鍑哄嚱鏁扮敤鏉ユ樉紺虹粨鏋溿?br />
import聽std.stdio;
import聽std.string;

typedef聽long聽
Time;
typedef聽long聽TimeInterval;

void聽output(
Time聽t){
聽聽writefln(
"Time:聽"~聽toString(cast(long)t));
}
void聽output(TimeInterval聽t){
聽聽writefln(
"Interval:聽"~聽toString(cast(long)t));
}
void聽main(){
聽聽
Timetime=聽cast(Time)100;
聽聽TimeInterval聽interval聽
=聽cast(TimeInterval)100;
聽聽output(
time);
聽聽output(interval);
}

鏄殑錛屼嬌鐢ㄤ笂楹葷儲浜嗗緢澶氾紝鍥犱負鎴戜滑璇曞浘鐢ㄤ竴涓暟鍊肩被鍨嬪幓琛ㄧず澶氫釜鐭㈤噺綾誨瀷銆?br />
榪欓噷Time time = cast(Time)100涓嶅啀鍙槸100榪欎釜綆鍗曠殑鏁板鹼紝瀹冭繕鎼哄甫浜員ime榪欎釜綾誨瀷銆俆imeInterval interval = cast(TimeInterval)100涔熶笉鍙槸100榪欎釜鏁板鹼紝鎴戜滑緇欏畠璧嬩簣浜嗘椂闂撮棿闅旂殑鍚箟銆?br />
榪樺彲浠ユ兂鍍忓緱鏇村紑闃斾竴浜涳紝鐢ㄥ畠瀹氫箟鏃墮棿銆侀暱搴︺侀潰縐佸姞閫熷害銆侀熷害銆佹俯搴︾瓑錛岄噸杞戒竴浜涜綆楀嚱鏁幫紙鍙儨D榪樹笉鏀寔鍏ㄥ眬鎿嶄綔絎﹂噸杞斤級錛岃繖鏍峰氨鏂逛究瀹屾垚涓浜涚墿鐞嗛噺鐨勮繍綆椾簡錛岃屼笖綾誨瀷寰楀埌媯鏌ワ紝閫熷害鍔犱竴涓暣鏁板肩粨鏋滆繕鏄熷害錛岄熷害涔樻椂闂村緱鍒扮殑鏄暱搴︼紝鏃墮棿鍑忔椂闂村緱鍒扮殑鏄椂闂撮棿闅旓紝閫熷害鍔犳椂闂村皢浜х敓緙栬瘧閿欒銆傘傘傘傘傘傜濂囩殑鏄繖浜涚被鍨嬪彲鑳介兘鏄竴浜涚畝鍗曠被鍨嬶紝鎴戠浉淇″畠鑷沖皯鍙互淇濊瘉榪愯鏁堢巼涓嶄細澶綆銆傚綋鐒朵綘鐢–錛嬶紜綾諱篃鍙互瀹屾垚榪欎簺錛屽茍涓斿埄鐢ㄧ紪璇戝櫒浼樺寲璁╁畠鐨勬晥鐜囦繚鎸佹渶楂橈紝鐢氳嚦鍐呰仈鐨勭粨鏋滃氨鏄畝鍗曠被鍨嬬殑榪愮畻錛屾垜榪樻槸鏇存効鎰忎嬌鐢ㄨ繖綆鍗曠殑綾誨瀷鏉ypedef銆傚綋鐒惰繖鍙兘闇瑕佸啓澶ч噺閲嶅鐨勫嚱鏁伴噸杞藉艦寮忥紝娌℃湁鍏崇郴錛屾垜鎯充嬌鐢ㄦā鏉垮拰mixin搴旇鍙互綆鍖栬繖涓榪囩▼錛岃屼笖浼氭湁鐩稿綋澶氱殑瀹朵紮浠効鎰忎嬌鐢ㄨ繖縐嶉夯鐑︾殑褰㈠紡鏉ヨ幏寰楁洿鈥滄紜濈殑緙栬瘧媯鏌ャ?br />

鎵浠ヨ錛孌璇█鐨則ypedef鐨勬剰涔夊叾瀹炲氨鏄疄鐜頒簡鐭㈤噺綾誨瀷銆?br />


鍙堝鎯充簡涓鐐廣?br />
寮虹被鍨嬭錛岃娉曠硸涔熷簲璇ヨ銆傛槸涓嶆槸鍙互鍊熼壌涓涓媟uby鐨勮娉曪紝瀹炵幇榪欑璋冪敤鍛紵

Length聽l聽=1.cm;
l聽
=1.m;
Time聽t聽=Time.now;
TimeInterval聽i聽
=3.hours;

鍏嶅幓浜嗕竴浜涘垵濮嬪寲鐨勯夯鐑︺?br />

qiezi 2006-09-19 20:16 鍙戣〃璇勮
]]>
[D璇█] DMD 0.166鍙戝竷http://www.shnenglu.com/cpunion/archive/2006/09/01/11938.htmlqieziqieziFri, 01 Sep 2006 14:34:00 GMThttp://www.shnenglu.com/cpunion/archive/2006/09/01/11938.htmlhttp://www.shnenglu.com/cpunion/comments/11938.htmlhttp://www.shnenglu.com/cpunion/archive/2006/09/01/11938.html#Feedback10http://www.shnenglu.com/cpunion/comments/commentRss/11938.htmlhttp://www.shnenglu.com/cpunion/services/trackbacks/11938.html
鍙栨秷鐨勭悊鐢辨槸榪欎釜杞崲澶殣鏅︿簡錛屾渶濂芥槸鏄懼紡鍦版爣紺哄嚭榪欑杞崲錛屾墍浠ュ紩鍏ヤ竴涓猯azy鍏抽敭瀛椼侱璇█榪樺湪鍙戝睍涓紝寰堝鐗規ч兘鍦ㄥ皾璇曪紝榪欑淇敼涔熶笉鏄涓嬈′簡銆?br />
棣栧厛鐪嬬湅榪欎釜lazy銆?br />
涓婁竴鐗堝疄鐜頒簡榪欐牱涓涓壒鎬э細

void聽log(char[]聽delegate()聽msg){
聽聽writefln(msg());
}

log(
"Hello,聽"~"Li聽Jie!聽\n"~"Welcome!");

log鐨勫弬鏁拌闅愬紡杞寲涓轟竴涓鎵橈紝榪欐牱鍙湁鐢ㄥ埌榪欎釜鍊肩殑鏃跺欐墠鐪熸姹傚箋?br />
鐢變簬榪欑闅愬紡杞寲寰堝鏄撳艦鎴愰櫡闃憋紝鎵浠ヨ繖涓鐗堟敼涓轟竴涓猯azy鍏抽敭瀛楋紝鐪嬭搗鏉ヨ綆媧佷竴浜涗簡錛?br />
void聽log(lazy聽char[]聽聽msg){
聽聽writefln(msg);
}

log(
"Hello,聽"~"Li聽Jie!聽\n"~"Welcome!");

log鍑芥暟涓嬌鐢╩sg榪欎釜鍙橀噺灝變細璋冪敤閭d釜闅愬紡鐨勫鎵橈紝瑕佹敞鎰忕殑鏄瘡嬈″彇msg鐨勫奸兘浼氭墽琛岃繖涓鎵橈紝鎵浠ユ垜瑙夊緱榪欎釜闄烽槺鏇村ぇ浜嗭紝褰撶劧瀹冩妸闄烽槺涓㈢粰緙栧啓浠g爜鐨勪漢錛岃屼笉鏄嬌鐢ㄤ唬鐮佺殑浜猴紝鎵浠ュソ鍧忚繕鏃犱粠鍒嗚鯨銆?br />
涓嬮潰榪欑偣浠g爜鍙互婕旂ず榪欎釜灝忛櫡闃憋細

void聽foo(lazy聽int聽a){
聽聽
int聽b聽=聽a+1;
聽聽
int聽c聽=聽a*3;
聽聽
int聽d聽=聽a/2;
}

int聽bar(){
聽聽writefln(
"Call聽bar()");
聽聽
return12;
}

foo(bar());

鐪嬭搗鏉ar濂藉儚浼氭墽琛屼竴嬈★紝瀹為檯涓婅繖孌典唬鐮佷細鎵撳嵃鍑?琛?Call bar()"錛屽師鏉ヤ嬌鐢ㄥ鎵樿繕鍙互鐪嬪埌涓涓樉寮忕殑鍑芥暟璋冪敤鍛€?br />
鍙︿竴涓猰ember templates鐗規ф湭瑙佸埌鏂囨。錛岀寽鎯沖ぇ姒傛槸鏀寔鎴愬憳鍑芥暟妯℃澘鍚с?br />

qiezi 2006-09-01 22:34 鍙戣〃璇勮
]]>
[D璇█] DMD 0.165鍙戝竷http://www.shnenglu.com/cpunion/archive/2006/08/21/11517.htmlqieziqieziMon, 21 Aug 2006 05:24:00 GMThttp://www.shnenglu.com/cpunion/archive/2006/08/21/11517.htmlhttp://www.shnenglu.com/cpunion/comments/11517.htmlhttp://www.shnenglu.com/cpunion/archive/2006/08/21/11517.html#Feedback2http://www.shnenglu.com/cpunion/comments/commentRss/11517.htmlhttp://www.shnenglu.com/cpunion/services/trackbacks/11517.html
璇︾粏淇℃伅鍙錛?a >http://www.digitalmars.com/d/lazy-evaluation.html

瀹冮鍏堣В鍐充簡涓涓瓨鍦ㄤ簬java涓殑鏃ュ織闂錛宩ava閲岄潰涓涓啓鏃ュ織鏍囧噯鏍煎紡濡備笅錛?br />
if聽(log.isLoggable(Level.INFO))聽{
聽聽log.info(
"aaaa");
}

鍥犱負log.info鐨勫弬鏁版眰鍊煎彲鑳藉獎鍝嶆ц兘錛屾墍浠ヤ嬌鐢ㄨ繖縐嶇箒鐞愮殑鏂瑰紡鏉ラ檷浣庡叧闂棩蹇楁椂鐨勬ц兘寮閿銆?br />
C/C++浣跨敤瀹忔潵瑙e喅榪欎釜闂錛屽敮涓鐨勯棶棰樻槸淇敼鏃ュ織綰у埆浼氬鑷撮」鐩繀欏婚噸緙栬瘧銆?br />
[娉細鎸囩殑鏄敤瀹忔潵瀹氫箟鏃ュ織綰у埆鐨勬柟寮忥紝浣跨敤鍏跺畠鍔ㄦ佷慨鏀規棩蹇楃駭鍒殑鏂瑰紡瀵規ц兘瑕佹眰寰堥珮鐨勯」鐩潵璇村彲鑳戒笉鍙帴鍙梋

D璇█浣跨敤鍙︿竴縐嶆柟寮忔潵瑙e喅錛岄鍏堣鐢ㄥ埌鈥滆〃杈懼紡鍒板鎵樼殑闅愬紡杞崲鈥濓紝涓嬮潰鏄鎵樹綔涓哄弬鏁版椂鐨勪嬌鐢ㄦ柟娉曪細

void聽foo(char[]聽delegate()聽dg){
聽聽writefln(dg());
}

foo(聽
delegatechar[]聽(){
聽聽聽聽
return"Hello,聽World";
聽聽}
);

鍥犱負榪欎釜濮旀墭騫朵笉闇瑕佸弬鏁幫紝鑰岃繑鍥炲煎彲浠ユ帹瀵鹼紝鎵浠ュ湪鏃╁厛鐨勪竴涓増鏈噷錛孌鍏佽鎴戜滑綆鍖栬繖涓繃紼嬶細

void聽foo(char[]聽delegate()聽dg){
聽聽writefln(dg());
}

foo({
return"Hello,聽World";});

DMD 0.165鍏佽鎴戜滑鏇磋繘涓姝ワ細

void聽foo(char[]聽delegate()聽dg){
聽聽writefln(dg());
}

foo(
"Hello,聽World");

榪欎釜瀛楃涓插弬鏁頒細琚殣寮忚漿鎹㈡垚涓涓鎵樸?br />
鐜板湪鍙互鐢ㄤ竴鏍風殑鏂規硶澶勭悊鏃ュ織錛屽湪娌℃湁瀹忕殑緋葷粺涓紝鏃ュ織鍑芥暟涓鑸牸寮忓涓嬶細

void聽log(char[]聽message)
{
聽聽聽聽
if聽(logging)
聽聽聽聽fwritefln(logfile,聽message);
}

涓轟簡璁╁畠浣跨敤鎳掓儼姹傚艱繖涓壒鎬э紝榪欓噷鎶婅繖涓嚱鏁扮殑鍙傛暟鏀逛負濮旀墭錛?br />
void聽log(char[]聽delegate()聽dg)
{
聽聽聽聽
if聽(logging)
聽聽聽聽fwritefln(logfile,聽dg());
}

浠庝笂闈㈡彁鍒扮殑鍐呭鎴戜滑鐭ラ亾浣跨敤瀹冧篃寰堢畝鍗曪細

log("My聽name聽is聽"~"Li聽Jie");

榪欎釜鍙傛暟鐨勬眰鍊煎氨鏄湪log鍑芥暟閲岄潰瀹屾垚鐨勩?br />
褰撶劧濮旀墭浼氬鍔犱竴浜涘紑閿錛屽湪涓婇潰榪欎釜渚嬪瓙涓紝榪欎釜寮閿鏄湪鏃ュ織鎵撳紑鏃舵墽琛屽鎵樻墍甯︽潵鐨勶紝瀹冨鍔犱簡涓嬈″鎵樿皟鐢ㄧ殑寮閿錛屼笉榪囧ソ鍦ㄦ墦寮鏃ュ織鍔熻兘鏃訛紝鍏跺畠鏂歸潰鐨勫紑閿榪滃ぇ榪囧鎵樿皟鐢ㄣ傚叧闂棩蹇楁椂錛屽畠涓嶄細甯︽潵寮閿錛屽畠鍙槸鎶婂瓧絎︿覆鎸囬拡鍘嬫爤鏀逛負濮旀墭鎸囬拡鍘嬫爤銆?img src ="http://www.shnenglu.com/cpunion/aggbug/11517.html" width = "1" height = "1" />

qiezi 2006-08-21 13:24 鍙戣〃璇勮
]]>
[D璇█] 鐢―璇█緙栧啓Ruby鎵╁睍http://www.shnenglu.com/cpunion/archive/2006/08/19/11427.htmlqieziqieziFri, 18 Aug 2006 22:17:00 GMThttp://www.shnenglu.com/cpunion/archive/2006/08/19/11427.htmlhttp://www.shnenglu.com/cpunion/comments/11427.htmlhttp://www.shnenglu.com/cpunion/archive/2006/08/19/11427.html#Feedback11http://www.shnenglu.com/cpunion/comments/commentRss/11427.htmlhttp://www.shnenglu.com/cpunion/services/trackbacks/11427.htmlRuby璇█鐨勫畼鏂硅В閲婄▼搴忔槸浣跨敤C璇█寮鍙戠殑錛屼竴鑸敤C璇█鏉ョ紪鍐欐墿灞曘侱璇█鍜孋璇█鏄簩榪涘埗鍏煎鐨勶紝鎵浠ュ彲浠ヤ嬌鐢―璇█緙栧啓Ruby鎵╁睍銆?br />


涓銆佺Щ妞岰搴撳埌D鐨勪竴鑸繃紼?/strong>

C浣跨敤澶存枃浠舵潵澶勭悊絎﹀彿渚濊禆錛屽湪D閲岄潰閾炬帴澶栭儴搴撴枃浠舵椂錛岃浣跨敤extern (C)澹版槑鏉ュ紩鍏ョ鍙鳳紝榪欐槸涓涓漿鎹㈣繃紼嬨?/p>

濡備綍杞崲涓涓狢澶存枃浠跺埌D鏂囦歡錛烡鏂囨。鐨刪tomodule.html鏈夎灝借鏄庛備竴鑸殑杞崲榪囩▼濡備笅錛?

1銆佽繍琛岄澶勭悊紼嬪簭澶勭悊鎺夊ご鏂囦歡閲岄潰鐨勫畯銆?/p>

2銆佸垹闄ょ粡榪囬澶勭悊浠ュ悗鐨勫浣欎俊鎭傜敱浜嶤鐨勫ご鏂囦歡鍖呭惈錛屾瘡涓ご鏂囦歡緇忚繃棰勫鐞嗕互鍚庨兘浼氬寘鍚竴浜涢噸澶嶅唴瀹癸紝鎴戜滑闇瑕佸墧闄よ繖閮ㄥ垎鍐呭錛岄氳繃鏌ユ壘琛屽彿鍗沖彲瀹屾垚銆?/p>

3銆佽漿鎹㈢浉搴斿0鏄庡埌D澹版槑錛岃繖涓姝ュ彲浠ヤ嬌鐢ㄤ竴涓猚2h紼嬪簭鏉ュ畬鎴愩?/p>

娉ㄦ剰棰勫鐞嗙▼搴忓鐞嗗畬姣曚互鍚庯紝瀹忓嚱鏁頒互鍙婂畯瀹氫箟鐨勫父閲忎細琚幓闄わ紝榪欏彲鑳戒笉鏄綘鎯寵鐨勶紝鎵浠ユ渶濂界殑鍔炴硶鍙兘鏄墜宸ヨ漿鎹€?/p>

鍙︿竴縐嶈皟鐢ㄦ槸鍦―閲岄潰璋冪敤鍔ㄦ侀摼鎺ュ簱錛岃繖闇瑕佷綘浣跨敤implib宸ュ叿浠庡姩鎬侀摼鎺ュ簱浜х敓涓涓?lib瀵煎叆搴撴枃浠訛紝鐒跺悗鐢熸垚D澹版槑錛屽啀緙栬瘧閾炬帴鍗沖彲銆傚鏋滄槸鍦╨inux涓嬩嬌鐢ㄥ叡浜簱錛屽垯鍙渶瑕佺紪鍐橠澹版槑鏂囦歡錛岀劧鍚庣洿鎺ラ摼鎺ュ嵆鍙?br />


浜屻佽皟鐢–搴?/strong>

杞崲瀹屾瘯浠ュ悗錛屽氨鍙互璋冪敤浜嗐傚鏋滀綘鍙槸瑕佹祴璇曚竴涓嬶紝灝卞彲浠ュ彧澹版槑浣跨敤榪囩殑澶栭儴鍑芥暟銆佸彉閲忓嵆鍙?/p>

渚嬪鎴戜滑瑕佺紪鍐橮rogramming Ruby閲岄潰鐨勪竴涓猂uby Extension渚嬪瓙錛岀浉搴旂殑D浠g爜濡備笅錛?/p>

// 聽test.d
module聽test;

import聽ruby;

extern (C)
VALUE聽t_init(VALUE聽self)
{
聽聽VALUE聽arr聽
= 聽rb_ary_new();
聽聽rb_iv_set(self,聽
" @arr " ,聽arr);
聽聽
return 聽self;
}

extern (C)
VALUE聽t_add(VALUE聽self,聽VALUE聽anObject)
{
聽聽VALUE聽arr聽
= 聽rb_iv_get(self,聽 " @arr " );
聽聽rb_ary_push(arr,聽anObject);
聽聽
return 聽arr;
}


extern (C){

VALUE聽cTest;

alias聽VALUE(
* func_type)();

export聽
void 聽Init_Test()
{
聽聽cTest聽
= 聽rb_define_class( " Test " ,聽rb_cObject);
聽聽rb_define_method(cTest,聽
" initialize " ,聽cast(func_type) & t_init,聽 0 );
聽聽rb_define_method(cTest,聽
" add " ,聽cast(func_type) & t_add,聽 1 );
}

}聽聽
// 聽extern(C)


鍜孋浠g爜寰堢浉浼箋傜敱浜庢垜浠彧浣跨敤浜嗗嚑涓閮ㄥ嚱鏁般佸彉閲忥紝鎵浠ュ彧闇瑕佸0鏄庤繖鍑犱釜絎﹀彿鍗沖彲錛?/p>

// 聽ruby.d
module聽ruby;

extern 聽(C){
聽聽聽聽alias聽
ulong 聽VALUE;
聽聽聽聽VALUE聽rb_cObject;
聽聽聽聽VALUE聽rb_ary_new聽();
聽聽聽聽VALUE聽rb_ary_push聽(VALUE,聽VALUE);
聽聽聽聽VALUE聽rb_iv_set聽(VALUE,聽聽
char * ,聽VALUE);
聽聽聽聽VALUE聽rb_iv_get聽(VALUE,聽聽
char * );
聽聽聽聽VALUE聽rb_define_class聽(聽
char * ,VALUE);
聽聽聽聽
void 聽rb_define_method聽(VALUE,聽 char * ,VALUE( * )(), int );
}


涓夈佺敓鎴愬姩鎬侀摼鎺ュ簱(Windows DLL)鎴栧叡浜簱(Linux so鏂囦歡)

D璇█鍦╓indows涓婄紪鍐橠LL錛岄櫎浜嗚鏈塂婧愭枃浠朵互澶栵紝榪樿鏈塂LL瀹氫箟鏂囦歡錛?/p>

// 聽test.def
LIBRARY聽聽聽聽聽聽聽聽聽Test
DESCRIPTION聽聽聽聽聽
' Test聽written聽in聽D '

EXETYPE聽聽NT
CODE聽聽聽聽聽聽聽聽聽聽聽聽PRELOAD聽DISCARDABLE
DATA聽聽聽聽聽聽聽聽聽聽聽聽PRELOAD聽SINGLE

榪欐槸涓涓氱敤鐨勬牸寮忥紝鍙槸涓浜涙弿榪頒俊鎭紝鍥犱負D涓彲浠ヤ嬌鐢╡xport鍏抽敭瀛楀鍑虹鍙鳳紝鎵浠ヤ笉闇瑕佸湪榪欓噷澹版槑瀵煎嚭鍑芥暟錛屽彧鏈夊湪緙栧啓COM DLL鏃舵墠浼氬鍔犲叾瀹冧竴浜涗俊鎭?/p>

鍙﹀鐢變簬D璇█瑕佸垵濮嬪寲GC浠ュ強鍏跺畠涓浜涗俊鎭紝鎵浠ヨ繕闇瑕佸湪DllMain閲岄潰璋冪敤鍒濆鍖栧強緇堟浠g爜銆傜敱浜庝笉鍚屽鉤鍙扮殑鍒濆鍖栬繃紼嬩笉瀹屽叏鐩稿悓錛岃繖閲屾垜綆鍗曞皝闂簡涓涓嬩笉鍚屽鉤鍙扮殑鍒濆鍖栦唬鐮侊細

// 聽os/library.d
module聽os.library;

extern (C){
聽聽
void 聽gc_init();
聽聽
void 聽gc_term();
聽聽version(Windows)聽
void 聽_minit();
聽聽
void 聽_moduleCtor();
聽聽
void 聽_moduleDtor();
聽聽
void 聽_moduleUnitTests();
聽聽version(linux)聽
void 聽_STI_monitor_staticctor();
聽聽version(linux)聽
void 聽_STI_critical_init();
聽聽version(linux)聽
void 聽_STD_monitor_staticdtor();
聽聽version(linux)聽
void 聽_STD_critical_term();
}

extern (C)
void 聽d_init()
{
聽聽
// 聽writefln("Start聽init聽D聽runtime");
聽聽version(linux)聽_STI_monitor_staticctor();
聽聽version(linux)聽_STI_critical_init();
聽聽gc_init();
聽聽version(Windows)聽_minit();
聽聽_moduleCtor();
聽聽_moduleUnitTests();
聽聽
// 聽writefln("init聽finished");
}

extern (C)
void 聽d_fini()
{
聽聽
// 聽writefln("Start聽term聽D聽runtime");
聽聽_moduleDtor();
聽聽gc_term();
聽聽version(linux)聽_STD_critical_term();
聽聽version(linux)聽_STD_monitor_staticdtor();
聽聽
// 聽writefln("term聽finished");
}

鐜板湪鍙互涓篧indows緙栧啓鍒濆鍖栧強緇堟浠g爜錛?/p>

// 聽os/dll.d
module聽os.dll;

private 聽import聽os.library;
private 聽import聽std.c.windows.windows;

HINSTANCE聽g_hInst;

extern 聽(Windows)
BOOL聽DllMain(HINSTANCE聽hInstance,聽ULONG聽ulReason,聽LPVOID聽pvReserved)
{
聽聽
switch 聽(ulReason)
聽聽{
聽聽聽聽
case 聽DLL_PROCESS_ATTACH:
聽聽聽聽聽聽d_init();
聽聽聽聽聽聽
break ;

聽聽聽聽
case 聽DLL_PROCESS_DETACH:
聽聽聽聽聽聽d_fini();
聽聽聽聽聽聽
break ;

聽聽聽聽
case 聽DLL_THREAD_ATTACH:
聽聽聽聽
case 聽DLL_THREAD_DETACH:
聽聽聽聽聽聽
// 聽Multiple聽threads聽not聽supported聽yet
聽聽聽聽聽聽 return false ;
聽聽}
聽聽g_hInst
= hInstance;
聽聽
return true ;
}

鐢變簬Linux鍏變韓搴撳茍娌℃湁鏍囧噯鐨勫叆鍙e嚱鏁?鎴栨槸鎴戜笉鐭ラ亾瀹?錛岃繖閲屼嬌鐢╣cc鎵╁睍鐨勫垵濮嬨佺粓姝唬鐮侊紝涓嶈繃鏄互C璇█瀹炵幇鐨勶細

// 聽os/so.c
#include聽 < ruby.h >
static void 聽so_init( void )聽__attribute__((constructor));
static void 聽so_fini( void )聽__attribute__((destructor));

extern void 聽d_init( void );
extern void 聽d_fini( void );

void 聽so_init( void )
{
聽聽d_init();
}

void 聽so_fini( void )
{
聽聽d_fini();
}

鐜板湪鍙互灝濊瘯緙栬瘧閾炬帴錛屽湪Linux涓婄紪璇戝懡浠ゅ涓嬶細

gcc聽 - o聽os / so.o聽 - c聽os / so.c聽 - I聽 / usr / lib / ruby / 1.8 / i686 - linux聽
gdc聽
- o聽Test.so聽test.d聽os / so.o聽ruby.d聽 - shared聽 - fPIC聽 - lruby

浣犲彲浠ュ湪irb涓嬫祴璇曪細

require聽 ' Test '
test聽
= 聽Test. new
test.add(
1 )
test.add(
2 )
test.add(
" a " )

鍙互鐪嬪埌add鎬繪槸榪斿洖涓涓猘rray錛屼笌鏈熸湜緇撴灉涓鑷淬?/p>

浣跨敤gdc鏄洜涓篸md鍦╨inux涓婃棤娉曠敓鎴愬叡浜簱銆?/p>

鍦╓indows涓婄殑緙栬瘧鍛戒護濡備笅錛?/p>

dmd聽 - oftest.dll聽test.d聽test.def聽ruby18.lib聽os / dll.d聽os / library.d

ruby18.lib鏄嬌鐢╥mplib浠巑svcrt-ruby18.dll瀵煎嚭鐨勶紝榪欎釜緙栬瘧榪囩▼寰堥『鍒╋紝涓嶈繃涓嶅垢鐨勬槸瀹冭繍琛屾湁涓浜涢棶棰橈紝澶ф鏄竴浜涘垵濮嬪奸敊璇紝鎴戞殏鏃惰繕娌℃湁鎵懼埌鍘熷洜銆傛垨璁鎬篃搴旇灝濊瘯涓涓媑dc錛屼笉榪囨垜涓嶇煡閬撳浣曚粠.DLL鏂囦歡瀵煎嚭涓涓猤dc鏀寔鐨凟LF鏍煎紡鐨勫鍏ュ簱鏂囦歡銆?br />

鍥涖侀」鐩墦綆?/strong>

鎵撶畻寤虹珛涓涓猺ubyd欏圭洰錛岄櫎浜嗚漿鎹uby澶存枃浠朵互澶栵紝榪樿浣滀竴浜涙墿灞曪紝姣斿杞崲D綾誨埌ruby綾伙紝榪欐柟闈㈠凡鏈夊熼壌錛屾瘮濡俤source.org涓婄殑pyd欏圭洰銆?/p>

鐢變簬浠ュ墠鍦ㄥ緩绔嬮」鐩柟闈㈡湁榪囧け璐ョ粡鍘?asgard欏圭洰鐢變簬鍏磋叮杞Щ鍜屽叾瀹冨師鍥犳瘮濡傝娉曚笐闄嬬瓑鑰屾湭鑳借繘琛?錛岃繖嬈¤繕鏄繚瀹堜竴浜涳紝鍏堝畬鎴怐澹版槑鐨勮漿鎹紝鎴戝凡緇忎嬌鐢ㄥ伐鍏瘋漿鎹簡鎵鏈夊ご鏂囦歡錛屼笉榪囨濡傚墠闈㈡墍璇達紝瀹忓嚱鏁板拰瀹忓父閲忛兘涓㈠け浜嗭紝鎵浠ラ渶瑕侀噸鏂版墜宸ヨ漿鎹€?br />

浜斻佸叾瀹冮棶棰?/strong>

1銆佸浣曚粠.DLL鏂囦歡瀵煎嚭涓涓猤dc鏀寔鐨凟LF鏍煎紡鐨勫鍏ュ簱鏂囦歡錛?strong>濡傛灉浣犵煡閬撳彲浠ュ憡璇夋垜錛屽厛璋㈣繃浜嗐?/p>

2銆乨md鐢熸垚鍙墽琛屾枃浠墮棶棰樹笉澶э紝鐢熸垚鍔ㄦ侀摼鎺ュ簱鎴栧叡浜簱鏈夊緢澶х己闄鳳紝鐗瑰埆鏄笉鑳界敓鎴愬叡浜簱錛屾垜鍙笉鎯沖啀鎵句竴涓彧鑳藉啀Windows涓婃甯歌繍琛岀殑緙栬瘧鍣ㄣ傚浣曡瀹冩敼榪涜繖浜涙柟闈紵

3銆乬dc浣跨敤dmd鍓嶇鍜実cc鍚庣錛屽簲璇ヤ細鎴愮啛涓浜涳紝涓嶈繃涓鑸細姣攄md鍓嶇鐗堟湰紼嶄綆錛岃屼笖gdc鍙戝竷鐗堟湰涓嶆槸寰堥綣侊紝澶ф4-5涓猟md鐗堟湰鎵嶄細鏈変竴涓猤dc鐗堟湰(鍒濈暐璁$畻)錛屾墍浠ヤ竴浜涙柊鐗規т笉鑳藉鍙婃椂鍔犲叆榪涙潵銆?/p>

qiezi 2006-08-19 06:17 鍙戣〃璇勮
]]>
COM鎺ュ彛IDL杞崲涓篋鎺ュ彛浠ュ強__uuidof瀹炵幇銆?/title><link>http://www.shnenglu.com/cpunion/archive/2006/04/11/5283.html</link><dc:creator>qiezi</dc:creator><author>qiezi</author><pubDate>Tue, 11 Apr 2006 06:26:00 GMT</pubDate><guid>http://www.shnenglu.com/cpunion/archive/2006/04/11/5283.html</guid><wfw:comment>http://www.shnenglu.com/cpunion/comments/5283.html</wfw:comment><comments>http://www.shnenglu.com/cpunion/archive/2006/04/11/5283.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/cpunion/comments/commentRss/5283.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/cpunion/services/trackbacks/5283.html</trackback:ping><description><![CDATA[D璇█閲岄潰錛屽彲浠ラ氳繃version(Windows)鏉ュ吋瀹笴OM鎺ュ彛錛屼笉榪囧浜巁_uuidof鍗存病鏈夌浉搴斿疄鐜般?br /><br />鍘熷COM鎺ュ彛瀹氫箟綾諱技榪欐牱錛堟壘涓畝鍗曠殑錛夛細<br /><br /><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><span style="COLOR: #000000">[<br />聽聽聽聽local,<br />聽聽聽聽</span><span style="COLOR: #0000ff">object</span><span style="COLOR: #000000">,<br />聽聽聽聽uuid(594f31d0</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">7f19</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">11d0</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">b194</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">00a0c90dc8bf)<br />]<br /></span><span style="COLOR: #0000ff">interface</span><span style="COLOR: #000000">聽IRpcChannelBuffer2聽:聽IRpcChannelBuffer<br />{<br /><br />聽聽聽聽HRESULT聽GetProtocolVersion<br />聽聽聽聽(<br />聽聽聽聽聽聽聽聽[</span><span style="COLOR: #0000ff">in</span><span style="COLOR: #000000">,</span><span style="COLOR: #0000ff">out</span><span style="COLOR: #000000">]聽DWORD聽</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">pdwVersion<br />聽聽聽聽);<br />}</span></div><br />VC錛嬶紜涓彲閫氳繃__uuidof鎿嶄綔絎︽潵鑾峰彇COM鎺ュ彛涓殑uuid鈥滃厓鈥濅俊鎭?br /><br />杞崲涓篋鎺ュ彛鍚庝唬鐮佸涓嬶細<br /><br /><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><span style="COLOR: #000000">version(Windows)聽{<br /><br /></span><span style="COLOR: #0000ff">interface</span><span style="COLOR: #000000">聽IRpcChannelBuffer2聽:聽IRpcChannelBuffer<br />{<br />聽聽聽聽HRESULT聽GetProtocolVersion聽(DWORD</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">聽pdwVersion);<br />}<br /><br />}</span></div><br />澶卞幓浜唘uid淇℃伅銆傚彧瑕佺◢浣滀慨鏀癸紝鍦ㄨ漿鎹㈡椂淇濆瓨uuid錛屽嵆鍙互妯℃澘鏉ユā鎷熷疄鐜癬_uuidof鎿嶄綔絎︺?br /><br /><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><span style="COLOR: #000000">import聽std.c.windows.com;<br />import聽std.</span><span style="COLOR: #0000ff">string</span><span style="COLOR: #000000">;<br />import聽std.stdio;<br /><br /></span><span style="COLOR: #0000ff">private</span><span style="COLOR: #000000">:<br /><br />template聽HexStrToUbyte(</span><span style="COLOR: #0000ff">char</span><span style="COLOR: #000000">[]聽str)<br />{<br />聽聽聽聽</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">聽ubyte聽HexStrToUbyte聽</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">聽cast(ubyte)HexStrToUlong</span><span style="COLOR: #000000">!</span><span style="COLOR: #000000">(str);<br />}<br /><br />template聽HexStrToUshort(</span><span style="COLOR: #0000ff">char</span><span style="COLOR: #000000">[]聽str)<br />{<br />聽聽聽聽</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">聽</span><span style="COLOR: #0000ff">ushort</span><span style="COLOR: #000000">聽HexStrToUshort聽</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">聽cast(</span><span style="COLOR: #0000ff">ushort</span><span style="COLOR: #000000">)HexStrToUlong</span><span style="COLOR: #000000">!</span><span style="COLOR: #000000">(str);<br />}<br /><br />template聽HexStrToUint(</span><span style="COLOR: #0000ff">char</span><span style="COLOR: #000000">[]聽str)<br />{<br />聽聽聽聽</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">聽</span><span style="COLOR: #0000ff">uint</span><span style="COLOR: #000000">聽HexStrToUint聽</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">聽cast(</span><span style="COLOR: #0000ff">uint</span><span style="COLOR: #000000">)HexStrToUlong</span><span style="COLOR: #000000">!</span><span style="COLOR: #000000">(str);<br />}<br /><br />template聽HexStrToUlong(</span><span style="COLOR: #0000ff">char</span><span style="COLOR: #000000">[]聽str)<br />{<br />聽聽聽聽</span><span style="COLOR: #0000ff">static</span><span style="COLOR: #000000">聽</span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">聽(str.length聽</span><span style="COLOR: #000000">==</span><span style="COLOR: #000000">聽</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">)<br />聽聽聽聽聽聽聽聽</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">聽</span><span style="COLOR: #0000ff">ulong</span><span style="COLOR: #000000">聽HexStrToUlong聽</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">聽HexToUbyte</span><span style="COLOR: #000000">!</span><span style="COLOR: #000000">(str[</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">..</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">]);<br />聽聽聽聽</span><span style="COLOR: #0000ff">else</span><span style="COLOR: #000000"><br />聽聽聽聽聽聽聽聽</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">聽</span><span style="COLOR: #0000ff">ulong</span><span style="COLOR: #000000">聽HexStrToUlong聽<br />聽聽聽聽聽聽聽聽聽聽聽聽</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">聽HexToUbyte</span><span style="COLOR: #000000">!</span><span style="COLOR: #000000">(str[length</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">..length])聽<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">聽</span><span style="COLOR: #000000">16UL</span><span style="COLOR: #000000">聽</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">聽HexStrToUlong</span><span style="COLOR: #000000">!</span><span style="COLOR: #000000">(str[</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">..length</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">]);<br />}<br /><br /></span><span style="COLOR: #0000ff">private</span><span style="COLOR: #000000">:<br /><br />template聽HexToUbyte(</span><span style="COLOR: #0000ff">char</span><span style="COLOR: #000000">[]聽c)<br />{<br />聽聽聽聽</span><span style="COLOR: #0000ff">static</span><span style="COLOR: #000000">聽</span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">聽(c[</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">]聽</span><span style="COLOR: #000000">>=</span><span style="COLOR: #000000">聽</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">聽</span><span style="COLOR: #000000">&&</span><span style="COLOR: #000000">聽c[</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">]聽</span><span style="COLOR: #000000"><=</span><span style="COLOR: #000000">聽</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">9</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">)<br />聽聽聽聽聽聽聽聽</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">聽ubyte聽HexToUbyte聽</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">聽c[</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">]聽</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">聽</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">;<br />聽聽聽聽</span><span style="COLOR: #0000ff">else</span><span style="COLOR: #000000">聽</span><span style="COLOR: #0000ff">static</span><span style="COLOR: #000000">聽</span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">聽(c[</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">]聽</span><span style="COLOR: #000000">==</span><span style="COLOR: #000000">聽</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">A</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">聽</span><span style="COLOR: #000000">||</span><span style="COLOR: #000000">聽c[</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">]聽</span><span style="COLOR: #000000">==</span><span style="COLOR: #000000">聽</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">a</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">)<br />聽聽聽聽聽聽聽聽</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">聽ubyte聽HexToUbyte聽</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">聽</span><span style="COLOR: #000000">0xa</span><span style="COLOR: #000000">;<br />聽聽聽聽</span><span style="COLOR: #0000ff">else</span><span style="COLOR: #000000">聽</span><span style="COLOR: #0000ff">static</span><span style="COLOR: #000000">聽</span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">聽(c[</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">]聽</span><span style="COLOR: #000000">==</span><span style="COLOR: #000000">聽</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">B</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">聽</span><span style="COLOR: #000000">||</span><span style="COLOR: #000000">聽c[</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">]聽</span><span style="COLOR: #000000">==</span><span style="COLOR: #000000">聽</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">b</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">)<br />聽聽聽聽聽聽聽聽</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">聽ubyte聽HexToUbyte聽</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">聽</span><span style="COLOR: #000000">0xb</span><span style="COLOR: #000000">;<br />聽聽聽聽</span><span style="COLOR: #0000ff">else</span><span style="COLOR: #000000">聽</span><span style="COLOR: #0000ff">static</span><span style="COLOR: #000000">聽</span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">聽(c[</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">]聽</span><span style="COLOR: #000000">==</span><span style="COLOR: #000000">聽</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">C</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">聽</span><span style="COLOR: #000000">||</span><span style="COLOR: #000000">聽c[</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">]聽</span><span style="COLOR: #000000">==</span><span style="COLOR: #000000">聽</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">c</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">)<br />聽聽聽聽聽聽聽聽</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">聽ubyte聽HexToUbyte聽</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">聽</span><span style="COLOR: #000000">0xc</span><span style="COLOR: #000000">;<br />聽聽聽聽</span><span style="COLOR: #0000ff">else</span><span style="COLOR: #000000">聽</span><span style="COLOR: #0000ff">static</span><span style="COLOR: #000000">聽</span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">聽(c[</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">]聽</span><span style="COLOR: #000000">==</span><span style="COLOR: #000000">聽</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">D</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">聽</span><span style="COLOR: #000000">||</span><span style="COLOR: #000000">聽c[</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">]聽</span><span style="COLOR: #000000">==</span><span style="COLOR: #000000">聽</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">d</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">)<br />聽聽聽聽聽聽聽聽</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">聽ubyte聽HexToUbyte聽</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">聽</span><span style="COLOR: #000000">0xd</span><span style="COLOR: #000000">;<br />聽聽聽聽</span><span style="COLOR: #0000ff">else</span><span style="COLOR: #000000">聽</span><span style="COLOR: #0000ff">static</span><span style="COLOR: #000000">聽</span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">聽(c[</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">]聽</span><span style="COLOR: #000000">==</span><span style="COLOR: #000000">聽</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">E</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">聽</span><span style="COLOR: #000000">||</span><span style="COLOR: #000000">聽c[</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">]聽</span><span style="COLOR: #000000">==</span><span style="COLOR: #000000">聽</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">e</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">)<br />聽聽聽聽聽聽聽聽</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">聽ubyte聽HexToUbyte聽</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">聽</span><span style="COLOR: #000000">0xe</span><span style="COLOR: #000000">;<br />聽聽聽聽</span><span style="COLOR: #0000ff">else</span><span style="COLOR: #000000">聽</span><span style="COLOR: #0000ff">static</span><span style="COLOR: #000000">聽</span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">聽(c[</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">]聽</span><span style="COLOR: #000000">==</span><span style="COLOR: #000000">聽</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">F</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">聽</span><span style="COLOR: #000000">||</span><span style="COLOR: #000000">聽c[</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">]聽</span><span style="COLOR: #000000">==</span><span style="COLOR: #000000">聽</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">f</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">)<br />聽聽聽聽聽聽聽聽</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">聽ubyte聽HexToUbyte聽</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">聽</span><span style="COLOR: #000000">0xf</span><span style="COLOR: #000000">;<br />}<br /><br />template聽HexToUbyte_bug(</span><span style="COLOR: #0000ff">char</span><span style="COLOR: #000000">聽c)<br />{<br />聽聽聽聽</span><span style="COLOR: #0000ff">static</span><span style="COLOR: #000000">聽</span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">聽(c聽</span><span style="COLOR: #000000">>=</span><span style="COLOR: #000000">聽</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">聽</span><span style="COLOR: #000000">&&</span><span style="COLOR: #000000">聽c聽</span><span style="COLOR: #000000"><=</span><span style="COLOR: #000000">聽</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">9</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">)<br />聽聽聽聽聽聽聽聽</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">聽ubyte聽HexToUbyte1聽</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">聽c聽</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">聽</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">;<br />聽聽聽聽</span><span style="COLOR: #0000ff">else</span><span style="COLOR: #000000">聽</span><span style="COLOR: #0000ff">static</span><span style="COLOR: #000000">聽</span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">聽(c聽</span><span style="COLOR: #000000">==</span><span style="COLOR: #000000">聽</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">A</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">聽</span><span style="COLOR: #000000">||</span><span style="COLOR: #000000">聽c聽</span><span style="COLOR: #000000">==</span><span style="COLOR: #000000">聽</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">a</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">)<br />聽聽聽聽聽聽聽聽</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">聽ubyte聽HexToUbyte1聽</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">聽</span><span style="COLOR: #000000">0xa</span><span style="COLOR: #000000">;<br />聽聽聽聽</span><span style="COLOR: #0000ff">else</span><span style="COLOR: #000000">聽</span><span style="COLOR: #0000ff">static</span><span style="COLOR: #000000">聽</span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">聽(c聽</span><span style="COLOR: #000000">==</span><span style="COLOR: #000000">聽</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">B</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">聽</span><span style="COLOR: #000000">||</span><span style="COLOR: #000000">聽c聽</span><span style="COLOR: #000000">==</span><span style="COLOR: #000000">聽</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">b</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">)<br />聽聽聽聽聽聽聽聽</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">聽ubyte聽HexToUbyte1聽</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">聽</span><span style="COLOR: #000000">0xb</span><span style="COLOR: #000000">;<br />聽聽聽聽</span><span style="COLOR: #0000ff">else</span><span style="COLOR: #000000">聽</span><span style="COLOR: #0000ff">static</span><span style="COLOR: #000000">聽</span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">聽(c聽</span><span style="COLOR: #000000">==</span><span style="COLOR: #000000">聽</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">C</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">聽</span><span style="COLOR: #000000">||</span><span style="COLOR: #000000">聽c聽</span><span style="COLOR: #000000">==</span><span style="COLOR: #000000">聽</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">c</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">)<br />聽聽聽聽聽聽聽聽</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">聽ubyte聽HexToUbyte1聽</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">聽</span><span style="COLOR: #000000">0xc</span><span style="COLOR: #000000">;<br />聽聽聽聽</span><span style="COLOR: #0000ff">else</span><span style="COLOR: #000000">聽</span><span style="COLOR: #0000ff">static</span><span style="COLOR: #000000">聽</span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">聽(c聽</span><span style="COLOR: #000000">==</span><span style="COLOR: #000000">聽</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">D</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">聽</span><span style="COLOR: #000000">||</span><span style="COLOR: #000000">聽c聽</span><span style="COLOR: #000000">==</span><span style="COLOR: #000000">聽</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">d</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">)<br />聽聽聽聽聽聽聽聽</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">聽ubyte聽HexToUbyte1聽</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">聽</span><span style="COLOR: #000000">0xd</span><span style="COLOR: #000000">;<br />聽聽聽聽</span><span style="COLOR: #0000ff">else</span><span style="COLOR: #000000">聽</span><span style="COLOR: #0000ff">static</span><span style="COLOR: #000000">聽</span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">聽(c聽</span><span style="COLOR: #000000">==</span><span style="COLOR: #000000">聽</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">E</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">聽</span><span style="COLOR: #000000">||</span><span style="COLOR: #000000">聽c聽</span><span style="COLOR: #000000">==</span><span style="COLOR: #000000">聽</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">e</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">)<br />聽聽聽聽聽聽聽聽</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">聽ubyte聽HexToUbyte1聽</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">聽</span><span style="COLOR: #000000">0xe</span><span style="COLOR: #000000">;<br />聽聽聽聽</span><span style="COLOR: #0000ff">else</span><span style="COLOR: #000000">聽</span><span style="COLOR: #0000ff">static</span><span style="COLOR: #000000">聽</span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">聽(c聽</span><span style="COLOR: #000000">==</span><span style="COLOR: #000000">聽</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">F</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">聽</span><span style="COLOR: #000000">||</span><span style="COLOR: #000000">聽c聽</span><span style="COLOR: #000000">==</span><span style="COLOR: #000000">聽</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">f</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">)<br />聽聽聽聽聽聽聽聽</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">聽ubyte聽HexToUbyte1聽</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">聽</span><span style="COLOR: #000000">0xf</span><span style="COLOR: #000000">;<br />}<br /><br />template聽IIDFromStr(</span><span style="COLOR: #0000ff">char</span><span style="COLOR: #000000">[]聽str)<br />{<br />聽聽聽聽</span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000">聽IID聽IIDFromStr聽</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">聽{<br />聽聽聽聽聽聽聽聽HexStrToUint</span><span style="COLOR: #000000">!</span><span style="COLOR: #000000">(str[</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">..</span><span style="COLOR: #000000">8</span><span style="COLOR: #000000">]),<br />聽聽聽聽聽聽聽聽HexStrToUshort</span><span style="COLOR: #000000">!</span><span style="COLOR: #000000">(str[</span><span style="COLOR: #000000">9</span><span style="COLOR: #000000">..</span><span style="COLOR: #000000">13</span><span style="COLOR: #000000">]),聽<br />聽聽聽聽聽聽聽聽HexStrToUshort</span><span style="COLOR: #000000">!</span><span style="COLOR: #000000">(str[</span><span style="COLOR: #000000">14</span><span style="COLOR: #000000">..</span><span style="COLOR: #000000">18</span><span style="COLOR: #000000">]),<br />聽聽聽聽聽聽聽聽[<br />聽聽聽聽聽聽聽聽聽聽HexStrToUbyte</span><span style="COLOR: #000000">!</span><span style="COLOR: #000000">(str[</span><span style="COLOR: #000000">19</span><span style="COLOR: #000000">..</span><span style="COLOR: #000000">21</span><span style="COLOR: #000000">]),<br />聽聽聽聽聽聽聽聽聽聽HexStrToUbyte</span><span style="COLOR: #000000">!</span><span style="COLOR: #000000">(str[</span><span style="COLOR: #000000">21</span><span style="COLOR: #000000">..</span><span style="COLOR: #000000">23</span><span style="COLOR: #000000">]),聽<br />聽聽聽聽聽聽聽聽聽聽HexStrToUbyte</span><span style="COLOR: #000000">!</span><span style="COLOR: #000000">(str[</span><span style="COLOR: #000000">24</span><span style="COLOR: #000000">..</span><span style="COLOR: #000000">26</span><span style="COLOR: #000000">]),<br />聽聽聽聽聽聽聽聽聽聽HexStrToUbyte</span><span style="COLOR: #000000">!</span><span style="COLOR: #000000">(str[</span><span style="COLOR: #000000">26</span><span style="COLOR: #000000">..</span><span style="COLOR: #000000">28</span><span style="COLOR: #000000">]),聽<br />聽聽聽聽聽聽聽聽聽聽HexStrToUbyte</span><span style="COLOR: #000000">!</span><span style="COLOR: #000000">(str[</span><span style="COLOR: #000000">28</span><span style="COLOR: #000000">..</span><span style="COLOR: #000000">30</span><span style="COLOR: #000000">]),<br />聽聽聽聽聽聽聽聽聽聽HexStrToUbyte</span><span style="COLOR: #000000">!</span><span style="COLOR: #000000">(str[</span><span style="COLOR: #000000">30</span><span style="COLOR: #000000">..</span><span style="COLOR: #000000">32</span><span style="COLOR: #000000">]),聽<br />聽聽聽聽聽聽聽聽聽聽HexStrToUbyte</span><span style="COLOR: #000000">!</span><span style="COLOR: #000000">(str[</span><span style="COLOR: #000000">32</span><span style="COLOR: #000000">..</span><span style="COLOR: #000000">34</span><span style="COLOR: #000000">]),<br />聽聽聽聽聽聽聽聽聽聽HexStrToUbyte</span><span style="COLOR: #000000">!</span><span style="COLOR: #000000">(str[</span><span style="COLOR: #000000">34</span><span style="COLOR: #000000">..</span><span style="COLOR: #000000">36</span><span style="COLOR: #000000">])<br />聽聽聽聽聽聽聽聽]<br />聽聽聽聽};<br />}<br /><br />template聽__uuidof(T:IUnknown)<br />{<br />聽聽聽聽IID聽__uuidof聽</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">聽IIDFromStr</span><span style="COLOR: #000000">!</span><span style="COLOR: #000000">(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">00000000-0000-0000-C000-000000000046</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">);<br />}<br /><br />template聽__uuidof(T:IClassFactory)<br />{<br />聽聽聽聽IID聽__uuidof聽</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">聽IIDFromStr</span><span style="COLOR: #000000">!</span><span style="COLOR: #000000">(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"><span style="COLOR: #000000">00000001-0000-0000-C000-000000000046</span></span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">);<br />}<br /><br /><br /></span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000">聽main()<br />{<br />聽聽聽聽IID聽iu聽聽</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">聽__uuidof</span><span style="COLOR: #000000">!</span><span style="COLOR: #000000">(IUnknown);<br />聽聽聽聽IID聽icp聽</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">聽__uuidof</span><span style="COLOR: #000000">!</span><span style="COLOR: #000000">(IClassFactory);<br /><br />聽聽聽聽writefln(iu.Data1);<br />聽聽聽聽writefln(iu.Data2);<br />聽聽聽聽writefln(iu.Data3);<br />聽聽聽聽writefln(iu.Data4);<br />}</span></div><br />濡備笂闈唬鐮侊紝鎺ュ彛鍦ㄨ漿鎹㈡椂錛屾妸錛?br /><br /><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><p><span style="COLOR: #000000">[<br />聽聽聽聽local,<br />聽聽聽聽</span><span style="COLOR: #0000ff">object</span><span style="COLOR: #000000">,<br />聽聽聽聽uuid(594f31d0</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">7f19</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">11d0</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">b194</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">00a0c90dc8bf)<br />]<br />interface IRpcChannelBuffer2 : IRpcChannelBuffer<br />{</span></p><p><span style="COLOR: #000000">聽聽聽 HRESULT GetProtocolVersion<br />聽聽聽 (<br />聽聽聽聽聽聽聽 [in,out] DWORD *pdwVersion<br />聽聽聽 );<br />}</span></p></div><br />杞崲涓猴細<br /><br /><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><span style="COLOR: #000000">template聽__uuidof(T:IRpcChannelBuffer2)<br />{<br />聽聽聽聽IID聽__uuidof聽</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">聽IIDFromStr</span><span style="COLOR: #000000">!</span><span style="COLOR: #000000">(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">594f31d0-7f19-11d0-b194-00a0c90dc8bf</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">);<br />}<br />version聽(Windows)聽{<br /><br /></span><span style="COLOR: #0000ff">interface</span><span style="COLOR: #000000">聽IRpcChannelBuffer2聽:聽IRpcChannelBuffer聽{<br />聽聽聽聽HRESULT聽GetProtocolVersion聽(DWORD</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">聽pdwVersion);<br />}<br /><br />}</span></div><br />鍗沖彲錛岃繖涓彲浠ヤ氦鐢辮嚜鍔ㄥ寲宸ュ叿瀹屾垚銆?br /><br />鐢變簬__uuidof妯℃澘鍊煎湪緙栬瘧鏈熷喅璁紝娌℃湁瀹為檯鐨勮繍琛屾湡寮閿銆?img src ="http://www.shnenglu.com/cpunion/aggbug/5283.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/cpunion/" target="_blank">qiezi</a> 2006-04-11 14:26 <a href="http://www.shnenglu.com/cpunion/archive/2006/04/11/5283.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>C++/D/python鎬ц兘涓姣?/title><link>http://www.shnenglu.com/cpunion/archive/2006/03/31/4840.html</link><dc:creator>qiezi</dc:creator><author>qiezi</author><pubDate>Fri, 31 Mar 2006 03:06:00 GMT</pubDate><guid>http://www.shnenglu.com/cpunion/archive/2006/03/31/4840.html</guid><wfw:comment>http://www.shnenglu.com/cpunion/comments/4840.html</wfw:comment><comments>http://www.shnenglu.com/cpunion/archive/2006/03/31/4840.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/cpunion/comments/commentRss/4840.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/cpunion/services/trackbacks/4840.html</trackback:ping><description><![CDATA[瀹為檯涓婁笉鏄叏闈㈡祴璇曟ц兘銆傚簲璇ヨ繖涔堣錛氫嬌鐢ㄤ竴涓綘鐔熸倝鐨勮璦錛岀敤瀹冨啓鍑轟竴涓珮鏁堢殑鐗堟湰錛堝仛涓嬮潰閭d歡浜嬶級銆?br /><br />涓嶅皬蹇冭鍒頒竴涓笘瀛愶細http://blog.vckbase.com/jzhang/archive/2006/03/28/18807.html<br /><br />鐪嬪埌C錛嬶紜绔熺劧琚瘮涓嬪幓浜嗭紝鑷劧涓嶆槸寰堣垝鏈嶏紝姣曠珶C錛嬶紜瀵逛簬C騫舵病鏈夊お澶х殑鎬ц兘涓婄殑闄嶄綆錛岃宲ython鏄疌鍐欑殑錛堟寚Cpython瀹炵幇錛夛紝鑷劧涓嶄細楂樿繃C銆傦紙搴熻瘽錛孋鍩烘湰涓婃帴榪戞眹緙栨晥鐜囦簡錛?br /><br />鍙儨C錛嬶紜鍙堝緢闅炬壘鍑鴻繖涔堥珮鏁堢殑瀹炵幇錛孲TL鏁堢巼榪樻槸浣庝簡浜涳紙涓轟粈涔堬紵涓鐩翠互涓哄畠寰堥珮鏁堬紝鐢ㄥ緱姣旇緝鏀懼績錛夈傛渶榪戜竴鐩存瘮杈冨叧娉―璇█錛屼簬鏄敤D璇█鏉ユ祴璇曚竴涓嬨備唬鐮佸涓嬶細<br /><br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 128, 128);">聽1</span>聽<span style="color: rgb(0, 0, 0);">import聽std.stdio;<br /></span><span style="color: rgb(0, 128, 128);">聽2</span>聽<span style="color: rgb(0, 0, 0);">import聽std.</span><span style="color: rgb(0, 0, 255);">string</span><span style="color: rgb(0, 0, 0);">;<br /></span><span style="color: rgb(0, 128, 128);">聽3</span>聽<span style="color: rgb(0, 0, 0);">import聽std.perf;<br /></span><span style="color: rgb(0, 128, 128);">聽4</span>聽<span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);">聽5</span>聽<span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);">聽main(</span><span style="color: rgb(0, 0, 255);">char</span><span style="color: rgb(0, 0, 0);">[][]聽argv)<br /></span><span style="color: rgb(0, 128, 128);">聽6</span>聽<span style="color: rgb(0, 0, 0);">{<br /></span><span style="color: rgb(0, 128, 128);">聽7</span>聽<span style="color: rgb(0, 0, 0);">聽聽</span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">聽(argv.length聽</span><span style="color: rgb(0, 0, 0);"><</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 0);">3</span><span style="color: rgb(0, 0, 0);">)聽{<br /></span><span style="color: rgb(0, 128, 128);">聽8</span>聽<span style="color: rgb(0, 0, 0);">聽聽聽聽writefln(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">Wrong聽arguments</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">);<br /></span><span style="color: rgb(0, 128, 128);">聽9</span>聽<span style="color: rgb(0, 0, 0);">聽聽聽聽</span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">;<br /></span><span style="color: rgb(0, 128, 128);">10</span>聽<span style="color: rgb(0, 0, 0);">聽聽}<br /></span><span style="color: rgb(0, 128, 128);">11</span>聽<span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);">12</span>聽<span style="color: rgb(0, 0, 0);">聽聽</span><span style="color: rgb(0, 0, 255);">const</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);">聽READ_SIZE聽</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 0);">1024</span><span style="color: rgb(0, 0, 0);">;<br /></span><span style="color: rgb(0, 128, 128);">13</span>聽<span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);">14</span>聽<span style="color: rgb(0, 0, 0);">聽聽FILE</span><span style="color: rgb(0, 0, 0);">*</span><span style="color: rgb(0, 0, 0);">聽fin聽</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">聽fopen(argv[</span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">],聽</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">r</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">);<br /></span><span style="color: rgb(0, 128, 128);">15</span>聽<span style="color: rgb(0, 0, 0);">聽聽FILE</span><span style="color: rgb(0, 0, 0);">*</span><span style="color: rgb(0, 0, 0);">聽fout聽</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">聽fopen(argv[</span><span style="color: rgb(0, 0, 0);">2</span><span style="color: rgb(0, 0, 0);">],聽</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">w</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">);<br /></span><span style="color: rgb(0, 128, 128);">16</span>聽<span style="color: rgb(0, 0, 0);">聽聽</span><span style="color: rgb(0, 0, 255);">char</span><span style="color: rgb(0, 0, 0);">聽buffer[READ_SIZE];<br /></span><span style="color: rgb(0, 128, 128);">17</span>聽<span style="color: rgb(0, 0, 0);">聽聽</span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);">[</span><span style="color: rgb(0, 0, 255);">char</span><span style="color: rgb(0, 0, 0);">[]]聽emails;<br /></span><span style="color: rgb(0, 128, 128);">18</span>聽<span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);">19</span>聽<span style="color: rgb(0, 0, 0);">聽聽PerformanceCounter聽counter聽</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);">聽PerformanceCounter();<br /></span><span style="color: rgb(0, 128, 128);">20</span>聽<span style="color: rgb(0, 0, 0);">聽聽counter.start();<br /></span><span style="color: rgb(0, 128, 128);">21</span>聽<span style="color: rgb(0, 0, 0);">聽聽</span><span style="color: rgb(0, 0, 255);">while</span><span style="color: rgb(0, 0, 0);">聽(</span><span style="color: rgb(0, 0, 0);">!</span><span style="color: rgb(0, 0, 0);">feof(fin)){<br /></span><span style="color: rgb(0, 128, 128);">22</span>聽<span style="color: rgb(0, 0, 0);">聽聽聽聽fgets(cast(</span><span style="color: rgb(0, 0, 255);">char</span><span style="color: rgb(0, 0, 0);">*</span><span style="color: rgb(0, 0, 0);">)buffer,聽READ_SIZE,聽fin);<br /></span><span style="color: rgb(0, 128, 128);">23</span>聽<span style="color: rgb(0, 0, 0);">聽聽聽聽</span><span style="color: rgb(0, 0, 255);">char</span><span style="color: rgb(0, 0, 0);">[]聽email聽</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">聽toString(cast(</span><span style="color: rgb(0, 0, 255);">char</span><span style="color: rgb(0, 0, 0);">*</span><span style="color: rgb(0, 0, 0);">)buffer);<br /></span><span style="color: rgb(0, 128, 128);">24</span>聽<span style="color: rgb(0, 0, 0);">聽聽聽聽</span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">聽(</span><span style="color: rgb(0, 0, 0);">!</span><span style="color: rgb(0, 0, 0);">(email聽</span><span style="color: rgb(0, 0, 255);">in</span><span style="color: rgb(0, 0, 0);">聽emails)){<br /></span><span style="color: rgb(0, 128, 128);">25</span>聽<span style="color: rgb(0, 0, 0);">聽聽聽聽聽聽emails[toString(buffer)]聽</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">;<br /></span><span style="color: rgb(0, 128, 128);">26</span>聽<span style="color: rgb(0, 0, 0);">聽聽聽聽聽聽fputs(cast(</span><span style="color: rgb(0, 0, 255);">char</span><span style="color: rgb(0, 0, 0);">*</span><span style="color: rgb(0, 0, 0);">)email,聽fout);<br /></span><span style="color: rgb(0, 128, 128);">27</span>聽<span style="color: rgb(0, 0, 0);">聽聽聽聽}<br /></span><span style="color: rgb(0, 128, 128);">28</span>聽<span style="color: rgb(0, 0, 0);">聽聽}<br /></span><span style="color: rgb(0, 128, 128);">29</span>聽<span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);">30</span>聽<span style="color: rgb(0, 0, 0);">聽聽fclose(fout);<br /></span><span style="color: rgb(0, 128, 128);">31</span>聽<span style="color: rgb(0, 0, 0);">聽聽fclose(fin);<br /></span><span style="color: rgb(0, 128, 128);">32</span>聽<span style="color: rgb(0, 0, 0);">聽聽counter.stop();<br /></span><span style="color: rgb(0, 128, 128);">33</span>聽<span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);">34</span>聽<span style="color: rgb(0, 0, 0);">聽聽writefln(counter.milliseconds());<br /></span><span style="color: rgb(0, 128, 128);">35</span>聽<span style="color: rgb(0, 0, 0);">聽聽</span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">;<br /></span><span style="color: rgb(0, 128, 128);">36</span>聽<span style="color: rgb(0, 0, 0);">}<br /></span><span style="color: rgb(0, 128, 128);">37</span>聽<span style="color: rgb(0, 0, 0);"></span></div><br />娌″姞fopen澶辮觸澶勭悊銆?br /><br />嫻嬭瘯緇撴灉鍦ㄦ垜鐨勬満鍣ㄤ笂鑰楁椂鍙湁python鐗堟湰鐨?/3錛屾垜鐪嬪埌鍏跺畠緗戝弸鐨凜錛嬶紜瀹炵幇鏈濂芥垚緇╀篃涓嶈繃1/2錛岀敱浜庢槸D鏄疌璇█鎵鍐欙紝嫻嬭瘯浣跨敤鐨勫張鏄疌搴擄紝鑷劧鍙互璁や負C璇█榪樻槸姣旇緝楂樻晥鐨勩?br /><br />涓婇潰鐨凞璇█浠g爜閲岃皟鐢ㄤ簡toString錛屾妸char*杞負char[]錛屽畠鐨勬簮浠g爜濡備笅錛?br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 255);">char</span><span style="color: rgb(0, 0, 0);">[]聽toString(</span><span style="color: rgb(0, 0, 255);">char</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 0);">*</span><span style="color: rgb(0, 0, 0);">s)<br />{<br />聽聽聽聽</span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);">聽s聽</span><span style="color: rgb(0, 0, 0);">?</span><span style="color: rgb(0, 0, 0);">聽s[</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">聽..聽strlen(s)]聽:聽cast(</span><span style="color: rgb(0, 0, 255);">char</span><span style="color: rgb(0, 0, 0);">[])</span><span style="color: rgb(0, 0, 255);">null</span><span style="color: rgb(0, 0, 0);">;<br />}</span></div><br />濡傛灉s[0 .. strlen(s)]浜х敓浜嗗鍒剁殑璇濓紝搴旇鏄細褰卞搷鎬ц兘鐨勩俢har[]瀵硅薄鏄彈GC綆$悊鐨勶紝搴旇浼氬鍒朵竴浠姐傝繖縐嶆儏鍐典笅榪樿兘鏈夊姝ら珮鐨勬晥鐜囷紝鐨勭‘寰堜笉閿欍?br /><br />涓嶈繃python鐨勬ц兘璁╂垜鎰熻寰堝悆鎯婏紝浠ュ墠鍙祴璇曡繃瀛楃涓茶繛鎺ワ紝鎰熻姣旇緝楂樻晥銆?br /><br />鍐欎簡涓涓畬鎴愪竴鏍峰姛鑳界殑ruby紼嬪簭錛岃楁椂鎺ヨ繎python鐗堟湰鐨?鍊嶏紝褰撶劧鐢變簬瀵瑰畠涓嶆槸寰堢啛錛屽彲鑳藉啓寰椾笉澶熼珮鏁堛?br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 128, 128);">聽1</span>聽<span style="color: rgb(0, 0, 0);">emails聽</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">聽Hash.</span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);">聽2</span>聽<span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);">聽3</span>聽<span style="color: rgb(0, 0, 0);">start聽</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">聽Time.now<br /></span><span style="color: rgb(0, 128, 128);">聽4</span>聽<span style="color: rgb(0, 0, 0);">fout聽</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">聽open(</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">email-2-new1.txt</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">,聽</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">w</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">)<br /></span><span style="color: rgb(0, 128, 128);">聽5</span>聽<span style="color: rgb(0, 0, 0);">open(</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">email-2.txt</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">).each聽</span><span style="color: rgb(0, 0, 255);">do</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 0);">|</span><span style="color: rgb(0, 0, 0);">line</span><span style="color: rgb(0, 0, 0);">|</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);">聽6</span>聽<span style="color: rgb(0, 0, 0);">聽聽</span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 0);">!</span><span style="color: rgb(0, 0, 0);">emails.has_key</span><span style="color: rgb(0, 0, 0);">?</span><span style="color: rgb(0, 0, 0);">聽line<br /></span><span style="color: rgb(0, 128, 128);">聽7</span>聽<span style="color: rgb(0, 0, 0);">聽聽聽聽emails[line]聽</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 128, 128);">聽8</span>聽<span style="color: rgb(0, 0, 0);">聽聽聽聽fout聽</span><span style="color: rgb(0, 0, 0);"><<</span><span style="color: rgb(0, 0, 0);">聽line<br /></span><span style="color: rgb(0, 128, 128);">聽9</span>聽<span style="color: rgb(0, 0, 0);">聽聽end<br /></span><span style="color: rgb(0, 128, 128);">10</span>聽<span style="color: rgb(0, 0, 0);">end<br /></span><span style="color: rgb(0, 128, 128);">11</span>聽<span style="color: rgb(0, 0, 0);">puts聽Time.now聽</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">聽start<br /></span><span style="color: rgb(0, 128, 128);">12</span>聽<span style="color: rgb(0, 0, 0);"></span></div><br />姝e鏌愮綉鍙嬫墍璇達紝榪欎釜紼嬪簭鐨勭摱棰堝湪浜嶪O錛屾嬁鏉ヤ綔鎬ц兘涓婄殑姣旇緝鎴栬鏄笉鍚堥傜殑銆備粠璇█鏁堢巼涓婃潵璁詫紝鑷劧鏄疌++鍜孌鐩稿綋錛屽彲鑳戒細姣擠楂橈紝python搴旇浼氫綆寰堝銆備絾鍦ㄥ緢澶氭儏鍐典笅錛岃 閲忔晥鐜囦笉鍏夋槸璇█鏈韓錛岃繕鏈夊簱錛屾病鏈夊簱鐨勮璦鏄病浠涔堝惛寮曞姏鐨勩俻ython鏄竴縐嶅緢鈥滄參鈥濈殑璇█錛岀浉瀵笴/C錛嬶紜鏉ヨ錛屼笉榪囧畠鏄竴闂ㄥ疄鐢ㄦх殑璇█錛屾墍浠ュ畠涓轟竴浜涚壒瀹氱敤娉曞仛浜嗕紭鍖栵紝鍙栧緱浜嗕笉閿欑殑鎴愮嘩銆侰錛嬶紜鏄竴闂ㄩ氱敤璇█錛屾垨璁稿お娉ㄩ噸璇█鐨勬ц兘浜嗭紝蹇界暐浜嗗簱錛屽鑷村簱鎶婃ц兘緇欐媺涓嬫潵浜嗐傝繖縐嶆儏鍐典笅錛屾湁浜鴻瘎嫻媕ava鍜孋錛嬶紜鐨勬ц兘錛岀粨鏋滄槸java瑕侀珮錛岃嚜鐒舵槸涓嶉偅涔堣浜烘儕濂囩殑浜嗐傚彲鏄鏋滄爣鍑嗗簱閮借繖涔堟參錛岄偅榪樿兘鎸囨湜浠涔堝憿錛?br /><br />褰撶劧涔熷茍娌℃湁璇佹槑STL灝辯壒鍒參錛屼篃鍙兘鏄嬌鐢ㄤ笉姝g‘銆?br /><br /><br />鍙槸鍒氬ソ鐪嬪埌榪欎釜姣旇緝錛屽繊涓嶄綇鍙備笌涓涓嬶紝鍒囧嬁褰撶湡銆?br /><img src ="http://www.shnenglu.com/cpunion/aggbug/4840.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/cpunion/" target="_blank">qiezi</a> 2006-03-31 11:06 <a href="http://www.shnenglu.com/cpunion/archive/2006/03/31/4840.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>[杞琞 digitalmars.D涓婄殑涓涓緩璁?/title><link>http://www.shnenglu.com/cpunion/archive/2006/03/28/4675.html</link><dc:creator>qiezi</dc:creator><author>qiezi</author><pubDate>Tue, 28 Mar 2006 02:31:00 GMT</pubDate><guid>http://www.shnenglu.com/cpunion/archive/2006/03/28/4675.html</guid><wfw:comment>http://www.shnenglu.com/cpunion/comments/4675.html</wfw:comment><comments>http://www.shnenglu.com/cpunion/archive/2006/03/28/4675.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/cpunion/comments/commentRss/4675.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/cpunion/services/trackbacks/4675.html</trackback:ping><description><![CDATA[鏍囬錛?font face="Arial" size="-1"><b>Proposal: Operator overloading without temporaries</b></font><br />浣滆咃細<font face="Arial" size="-1"><a href="mailto:dac@nospam.com.au">Don Clugston <dac@nospam.com.au></a><br /><br /></font>姝f枃錛?br />Background: Operator overloading, in the form it exists in C++ and <br />currently in D, inherently results in sub-optimal code, because it <br />always results in unnecessary temporary objects being created.<br /><br />For example,<br />X = A - ((B*C) + D)* E;<br /><br />becomes:<br />T1 = B * C;<br />T2 = T1 + D;<br />T3 = T2 * E;<br />T4 = A - T3;<br />X = T4;<br />Four objects were created, whereas only one was strictly required.<br />In C++, there are libraries like Blitz++ which use complicated <br />expression templates in order to avoid these creating these temporaries, <br />and provide performance comparable with FORTRAN. I think D can do much <br />better...<br />Note that temporaries are avoided when using the opXXXAssign() operators <br />like +=.<br /><br />===========<br />聽聽 Proposal<br />===========<br />(1) Allow the compiler to assume that b = b + c聽 can be replaced with b <br />+= c. (In C++, operator + and operator += are just symbols, the compiler <br />doesn't know that there is any relationship between them).<br />In the example above, this would allow the compiler to generate:<br />T1 = B * C;<br />T1 += D;<br />T1 *= E;<br /><br />and we have eliminated two of the three temporaries.<br />(2). Fill in the gaps in the operator overloading table by introducing<br />opAddAssign_r, opSubAssign_r, etc.<br /><br />Just as A.opSubAssign(B)<br />is the operation聽 A -= B聽 or equivalently聽 A = A - B, similarly<br /><br />A.opSubAssign_r(B)<br />would mean<br />A = B - A.<br />and would only occur when temporaries are generated in expressions. Like <br />-=, it's an operation which can frequently be performed very <br />efficiently, but at present the language has no way of expressing it.<br /><br />Our original example then becomes:<br /><br />T1 = B.opMul(C);<br />T1.opAddAssign(D);<br />T1.opMulAssign(E);<br />T1.opSubAssign_r(A);<br />X = T1;<br />... and all the useless temporaries are gone!<br /><br />More formally, when the expression tree for an expression is generated:<br />With a binary operator XXX, operating on left & right nodes:<br /><br />if (the left node is *not* an original leaf node) {<br />聽聽聽 // the left node is a temporary, does not need to be preserved.<br />聽聽聽 // we don't care if the right node is a temporary or not<br />聽聽聽 look for opXXXAssign().<br />} else if (the the right node is not an original leaf node) {<br />聽聽聽 // the right node is a temporary<br />聽聽聽 look for opXXXAssign_r()<br />} else {<br />聽聽 // both left and right nodes are leaf nodes, we have to<br />聽聽 // create a temporary<br />聽聽聽 look for opXXX(), just as it does now.<br />}<br /><br />These rules also cope with the situation where temporaries are required:<br />eg<br />X = (A*B) + (C*D);<br />becomes<br />T1 = A*B;<br />T2 = C*D;<br />T1 += T2;<br />X = T1;<br /><br />If this were implemented, it would permanently eradicate (for D) the <br />most significant advantage which Fortran has managed to retain over <br />object-oriented languages. And I really don't think it would be <br />difficult to implement, or have negative side-effects.<br /><br />There are a couple of decisions to be made:<br />(I) should the compiler use opAdd() and generate a temporary, if <br />opAddAssign_r() doesn't exist, to preserve existing behaviour? I think <br />the answer to this is YES.<br />(II) should the compiler use opAdd() and generate a temporary, if <br />oppAddAssign() doesn't exist, to preserve existing behaviour? Again, I'm <br />inclined to answer YES.<br />(III) If the code includes +=, and there is an opAdd() but no <br />opAddAssign(), should the compiler accept this, and just generate an <br />opAdd() followed by an assignment?? This would mean that opAdd() would <br />generate the += operation as well as +, while opAddAssign() would be a <br />performance enhancement. (It would still be possible to have <br />opAddAssign() without opAdd(), to have += but not +, but it would not be <br />possible to have + without +=). This would mean that += would be <br />*purely* syntactic sugar.<br /><br />Decision III would be a little more difficult to implement and is of <br />less obvious merit, I only mention it as a possibility.<br /><br />Comments? <br /><img src ="http://www.shnenglu.com/cpunion/aggbug/4675.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/cpunion/" target="_blank">qiezi</a> 2006-03-28 10:31 <a href="http://www.shnenglu.com/cpunion/archive/2006/03/28/4675.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>D璇█妯℃澘鏈榪戠殑涓浜涙敼榪?/title><link>http://www.shnenglu.com/cpunion/archive/2006/03/15/4204.html</link><dc:creator>qiezi</dc:creator><author>qiezi</author><pubDate>Wed, 15 Mar 2006 09:03:00 GMT</pubDate><guid>http://www.shnenglu.com/cpunion/archive/2006/03/15/4204.html</guid><wfw:comment>http://www.shnenglu.com/cpunion/comments/4204.html</wfw:comment><comments>http://www.shnenglu.com/cpunion/archive/2006/03/15/4204.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/cpunion/comments/commentRss/4204.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/cpunion/services/trackbacks/4204.html</trackback:ping><description><![CDATA[涓嶇煡閬撲粈涔堟椂鍊欏姞鍏ヤ簡鈥滃嚱鏁版ā鏉垮弬鏁扮被鍨嬫帹瀵尖濆拰鈥滅被妯℃澘錛堟敼榪涘瀷錛夆濓紝鏂囨。涓篃鏄倓鎮勫嚭鐜頒簡銆?br> <br> 鍑芥暟妯℃澘鍙傛暟綾誨瀷鎺ㄥ錛?br> <pre class="d_code"><span style="color: blue;">template</span> <b>Square</b>(T)<br>{<br> T <b>Square</b>(T t)<br> {<br> <span style="color: blue;">return</span> t * t;<br> }<br>}</pre> 浠ュ墠璋冪敤鏃跺繀欏繪樉寮忓疄渚嬪寲錛?br> <pre class="d_code">writefln(<span style="color: red;">"The square of %s is %s"</span>, 3, Square!(<span style="color: blue;">int</span>)(3));<br><br>鐜板湪鍙互浣跨敤鑷姩鎺ㄥ浜嗭細<br><br>writefln(<span style="color: red;">"The square of %s is %s"</span>, 3, Square(3)); <span style="color: green;">// T is deduced to be int<br><br><br></span>綾繪ā鏉夸互鍓嶅繀欏昏繖鏍峰啓錛?br><span style="color: blue;">template</span> <b>Bar</b>(T)<br>{<br> <span style="color: blue;">class</span> <b>Bar</b><br> {<br> T member;<br> }<br>}<br><br>鐜板湪鍙互鍐欎負錛?br><span style="color: blue;">class</span> <b>Bar</b>(T)<br>{<br> T member;<br>}<br><br>鍚箟鐩稿悓銆?br><span style="color: green;"></span></pre><img src ="http://www.shnenglu.com/cpunion/aggbug/4204.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/cpunion/" target="_blank">qiezi</a> 2006-03-15 17:03 <a href="http://www.shnenglu.com/cpunion/archive/2006/03/15/4204.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>浠嶤錛嬶紜鍒癉http://www.shnenglu.com/cpunion/archive/2006/03/14/4129.htmlqieziqieziTue, 14 Mar 2006 04:10:00 GMThttp://www.shnenglu.com/cpunion/archive/2006/03/14/4129.htmlhttp://www.shnenglu.com/cpunion/comments/4129.htmlhttp://www.shnenglu.com/cpunion/archive/2006/03/14/4129.html#Feedback0http://www.shnenglu.com/cpunion/comments/commentRss/4129.htmlhttp://www.shnenglu.com/cpunion/services/trackbacks/4129.html1 class Foo2 {3 &nbs...  闃呰鍏ㄦ枃

qiezi 2006-03-14 12:10 鍙戣〃璇勮
]]>
DMD 0.149鍙戝竷http://www.shnenglu.com/cpunion/archive/2006/03/08/3888.htmlqieziqieziWed, 08 Mar 2006 03:36:00 GMThttp://www.shnenglu.com/cpunion/archive/2006/03/08/3888.htmlhttp://www.shnenglu.com/cpunion/comments/3888.htmlhttp://www.shnenglu.com/cpunion/archive/2006/03/08/3888.html#Feedback0http://www.shnenglu.com/cpunion/comments/commentRss/3888.htmlhttp://www.shnenglu.com/cpunion/services/trackbacks/3888.html
0.147涓姞鍏ヤ簡match琛ㄨ揪寮忥紝涓嶈繃鎰熻鐢ㄥ澶皬浜嗙偣錛屾灉鐒?.148涓張鍘繪帀浜嗐?BR>0.148涓幓鎺変簡bit綾誨瀷錛屽鍔犱簡BitArray綾誨拰bool鍩烘湰綾誨瀷銆俹n_scope璇彞綆楁槸涓瘮杈冮噸瑕佺殑鏇存柊錛屽彲鐢ㄤ簬鍦ㄤ唬鐮佸潡緇撴潫銆佸紓甯搞佹垚鍔熸墽琛屾椂錛屽畬鎴愮壒瀹氬姛鑳姐?BR>0.149涓璷n_scope璇彞鏀規垚浜唖cope(...)銆?img src ="http://www.shnenglu.com/cpunion/aggbug/3888.html" width = "1" height = "1" />

qiezi 2006-03-08 11:36 鍙戣〃璇勮
]]>
DMD 0.141鍙戝竷http://www.shnenglu.com/cpunion/archive/2005/12/06/1558.htmlqieziqieziTue, 06 Dec 2005 02:41:00 GMThttp://www.shnenglu.com/cpunion/archive/2005/12/06/1558.htmlhttp://www.shnenglu.com/cpunion/comments/1558.htmlhttp://www.shnenglu.com/cpunion/archive/2005/12/06/1558.html#Feedback2http://www.shnenglu.com/cpunion/comments/commentRss/1558.htmlhttp://www.shnenglu.com/cpunion/services/trackbacks/1558.htmlWhat's New for D 0.141

Dec 1, 2005

New/Changed Features

  • The predefined version identifier D_InlineAsm has been changed to D_InlineAsm_X86. The former made no sense, and although it is still defined, it is deprecated.
  • Added D code coverage analyzer.
  • Added .mangleof property for types, which gives the 'mangled' type name as a string.

Bugs Fixed



鍏朵腑鈥淒浠g爜瑕嗙洊鍒嗘瀽鍣ㄢ濆簲璇ユ槸寰堝浜烘劅鍏磋叮鐨勪笢瑗夸簡錛屼笅闈㈡槸涓涓緥瀛?鎽樿嚜http://digitalmars.com/d/code_coverage.html)錛?/P>

/* Eratosthenes Sieve prime number calculation. */
 
bit flags[
8191];
 
int main()
{   
int     i, prime, k, count, iter;

    printf(
"10 iterations\n");
    
for (iter = 1; iter <= 10; iter++)
    {    count 
= 0;
    flags[] 
= true;
    
for (i = 0; i < flags.length; i++)
    {   
if (flags[i])
        {    prime 
= i + i + 3;
        k 
= i + prime;
        
while (k < flags.length)
        {
            flags[k] 
= false;
            k 
+= prime;
        }
        count 
+= 1;
        }
    }
    }
    printf (
"\n%d primes\n", count);
    
return 0;
}

緙栬瘧銆佽繍琛岋細
dmd sieve -cov
sieve
緇撴灉濡備笅錛?BR>
       |/* Eratosthenes Sieve prime number calculation. */
       |
       |bit flags[8191];
       |
       |int main()
      5|{   int     i, prime, k, count, iter;
       |
      1|    printf("10 iterations\n");
     22|    for (iter = 1; iter <= 10; iter++)
     10|    {   count = 0;
     10|        flags[] = true;
163840|        for (i = 0; i < flags.length; i++)
  81910|        {   if (flags[i])
  18990|            {   prime = i + i + 3;
  18990|                k = i + prime;
168980|                while (k < flags.length)
       |                {
149990|                    flags[k] = false;
149990|                    k += prime;
       |                }
  18990|                count += 1;
       |            }
       |        }
       |    }
      1|    printf ("\n%d primes\n", count);
      1|    return 0;
       |}
sieve.d is 100% covered

鍙︿竴涓儕鍠滄槸mangleof灞炴э紝鍙互寰楀埌涓涓被鍨嬭緙栬瘧鍣╩angle鍚庣殑鍚嶅瓧銆備笉鐭ラ亾mangle瀵瑰簲鐨勪腑鏂囩炕璇戞槸浠涔堬紵澶ф鏄滃悕瀛楄漿鎹⑩濆惂銆備竴鐐規祴璇曚唬鐮侊細
import std.stdio;

void test();

void test1(int n);

void test2(int n);


void main()
{
    
void function (intchar[]) f;
    
void function (int) f1;
    
void function () f2;
    writefln (f.mangleof);
    writefln (f1.mangleof);
    writefln (f2.mangleof);
    writefln (
int.mangleof);
    
float a;
    writefln (a.mangleof);
    writefln ((
&test).mangleof);
    writefln ((
&test1).mangleof);
    writefln ((
&test2).mangleof);
    writefln (
void.mangleof);
}
緙栬瘧鎵ц緇撴灉濡備笅錛?BR>
PFiAaZv
PFiZv
PFZv
i
f
PFZv
PFiZv
PFiZv
v


qiezi 2005-12-06 10:41 鍙戣〃璇勮
]]>
DMD 0.140鍙戝竷http://www.shnenglu.com/cpunion/archive/2005/11/25/1304.htmlqieziqieziFri, 25 Nov 2005 05:38:00 GMThttp://www.shnenglu.com/cpunion/archive/2005/11/25/1304.htmlhttp://www.shnenglu.com/cpunion/comments/1304.htmlhttp://www.shnenglu.com/cpunion/archive/2005/11/25/1304.html#Feedback0http://www.shnenglu.com/cpunion/comments/commentRss/1304.htmlhttp://www.shnenglu.com/cpunion/services/trackbacks/1304.htmlNov 23, 2005

New/Changed Features

  • Added std.string.soundex.
  • Added std.string.entab.
  • Added std.string.wrap.
  • Added std.string.abbrev.
  • Added std.windows.charset (thanks to Stewart Gordon, D/28246).
  • Added std.demangle to demangle D names.
  • Improved promotion of names inside templates.
  • Now allows floating point and string literals as template value arguments.
  • To support the previous, the name mangling of template instances has changed. This will necessitate recompilation of any code that uses templates.
  • std.utf.UtfError is now deprecated. Use std.utf.UtfException instead.

Bugs Fixed


姣旇緝鎰熷叴瓚g殑鏄誕鐐規暟鍜屽瓧絎︿覆甯擱噺浣滀負妯℃澘鍊煎弬鏁幫紝綆鍗曟祴璇曚簡涓涓嬶細

import std.stdio;

template TFloat (
float F)
{
    
float value = F;
}

template TString (
char[] S)
{
    
char[] value = S;
}

void main()
{
    alias TFloat
!(3.14f) PI;
    writefln(PI.value);
    writefln(TString
!("hello").value);
}

緙栬瘧閫氳繃錛岃繍琛岀粨鏋滃涓嬶細

3.14
hello

qiezi 2005-11-25 13:38 鍙戣〃璇勮
]]>
DMDScript鑴氭湰宸ュ叿錛孌DL欏圭洰http://www.shnenglu.com/cpunion/archive/2005/11/20/1200.htmlqieziqieziSat, 19 Nov 2005 16:20:00 GMThttp://www.shnenglu.com/cpunion/archive/2005/11/20/1200.htmlhttp://www.shnenglu.com/cpunion/comments/1200.htmlhttp://www.shnenglu.com/cpunion/archive/2005/11/20/1200.html#Feedback0http://www.shnenglu.com/cpunion/comments/commentRss/1200.htmlhttp://www.shnenglu.com/cpunion/services/trackbacks/1200.htmlhttp://www.digitalmars.com/dscript鐪嬪埌璇︾粏淇℃伅錛屽彟澶栨湁涓涓狢++鐨勫疄鐜扮増鏈?BR>
鍙﹀2涓鍚圗CMA 262瑙勮寖鐨勮剼鏈璦鍒嗗埆鏄疦etscape鐨刯avascript鍜孧icrosoft鐨凧Script錛岀洰鍓岲MDScript鍜屽叾瀹?涓笉瀹屽叏鍏煎錛屼笉榪囨晥鐜囪楂樹竴浜涖侱MDScript鎻愪緵浜嗕竴涓畝鍗曠殑嫻嬭瘯錛岀敓鎴?190浠ュ唴鐨勮川鏁幫紝榪唬10嬈★紝鍦ㄦ垜鐨勬満鍣ㄤ笂錛宩avascript鎵ц鑰楁椂566姣錛孌MDScript鎵ц鑰楁椂188姣錛屾暣鏁村揩浜?鍊嶃?BR>
濡傛灉浣犳兂瀹炵幇涓涓鍚圗CMA 262鏍囧噯鐨勮剼鏈璦錛屽緩璁湅榪欎喚浠g爜鐨勫疄鐜板惂錛屾瘮杈冪畝媧侊紝鍙湁400澶欿銆傚井杞偅浠戒及璁℃槸寰堥毦鐪嬪埌浜嗭紝Netscape閭d喚鐢–鍐欑殑錛屼唬鐮佸ぇ灝忓氨鏈夎繎3M錛屽畯涔熸瘮杈冨錛岀湅璧鋒潵瑕佸悆鍔涗竴浜涖?BR>


DDL鏄痙source.org涓婄殑涓涓湁瓚g殑欏圭洰錛屽畠鍙互浠?obj鎴?lib鏂囦歡涓姞杞戒唬鐮佸茍鎵ц錛岀洰鍓嶆敮鎸丆OFF銆丱MF銆丒LF鏍煎紡銆?img src ="http://www.shnenglu.com/cpunion/aggbug/1200.html" width = "1" height = "1" />

qiezi 2005-11-20 00:20 鍙戣〃璇勮
]]>
D璇█鐨勬ā鏉?/title><link>http://www.shnenglu.com/cpunion/archive/2005/11/11/1083.html</link><dc:creator>qiezi</dc:creator><author>qiezi</author><pubDate>Fri, 11 Nov 2005 09:13:00 GMT</pubDate><guid>http://www.shnenglu.com/cpunion/archive/2005/11/11/1083.html</guid><wfw:comment>http://www.shnenglu.com/cpunion/comments/1083.html</wfw:comment><comments>http://www.shnenglu.com/cpunion/archive/2005/11/11/1083.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/cpunion/comments/commentRss/1083.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/cpunion/services/trackbacks/1083.html</trackback:ping><description><![CDATA[D璇█鐨勬ā鏉夸嬌鐢ㄩ潪甯告柟渚跨伒媧伙紝鍙楀浜咰錛嬶紜妯℃澘緙栧啓涔嬭嫤鐨勫悓瀛︿滑鍙互鎰熷彈涓涓婦璇█鐨勬ā鏉匡紝涓嬮潰鍏堝睍紺轟竴涓狣璇█緙栧啓鐨勫鍒嗘淳濮旀墭綾伙紝鍦ㄦ垜鐨勬棫BLOG涓婃浘緇忓啓榪囦竴涓狢錛嬶紜鐗堟湰鐨勶紝鏁翠釜榪囩▼鎰熻闈炲父鐥涜嫤銆傘傘?BR><BR>闂茶瘽灝戣錛岃鐪嬩唬鐮侊細<BR><BR> <DIV style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><SPAN style="COLOR: #000000">import std.stdio;<BR><BR><BR>template DelegateHandlers(HandlerType, FunctionType)<BR>{<BR>    HandlerType[] handlers;<BR>    FunctionType[] functions;<BR><BR>    </SPAN><SPAN style="COLOR: #0000ff">void</SPAN><SPAN style="COLOR: #000000"> opAddAssign(HandlerType h)<BR>    {<BR>        handlers.length </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> handlers.length </SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">1</SPAN><SPAN style="COLOR: #000000">;<BR>        handlers[length</SPAN><SPAN style="COLOR: #000000">-</SPAN><SPAN style="COLOR: #000000">1</SPAN><SPAN style="COLOR: #000000">] </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> h;<BR>    }<BR>    </SPAN><SPAN style="COLOR: #0000ff">void</SPAN><SPAN style="COLOR: #000000"> opAddAssign(FunctionType f)<BR>    {<BR>        functions.length </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> functions.length </SPAN><SPAN style="COLOR: #000000">+</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">1</SPAN><SPAN style="COLOR: #000000">;<BR>        functions[length</SPAN><SPAN style="COLOR: #000000">-</SPAN><SPAN style="COLOR: #000000">1</SPAN><SPAN style="COLOR: #000000">] </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> f;<BR>    }<BR>}<BR><BR>template Delegate(Ret)<BR>{<BR>    </SPAN><SPAN style="COLOR: #0000ff">class</SPAN><SPAN style="COLOR: #000000"> Delegate<BR>    {<BR>        alias Ret </SPAN><SPAN style="COLOR: #0000ff">delegate</SPAN><SPAN style="COLOR: #000000"> () HandlerType;<BR>        alias Ret function () FunctionType;<BR>        mixin DelegateHandlers</SPAN><SPAN style="COLOR: #000000">!</SPAN><SPAN style="COLOR: #000000">(HandlerType, FunctionType);<BR><BR>        </SPAN><SPAN style="COLOR: #0000ff">static</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">if</SPAN><SPAN style="COLOR: #000000">(</SPAN><SPAN style="COLOR: #0000ff">is</SPAN><SPAN style="COLOR: #000000">(Ret: </SPAN><SPAN style="COLOR: #0000ff">void</SPAN><SPAN style="COLOR: #000000">))<BR>        {<BR>            </SPAN><SPAN style="COLOR: #0000ff">void</SPAN><SPAN style="COLOR: #000000"> opCall ()<BR>            {<BR>                </SPAN><SPAN style="COLOR: #0000ff">foreach</SPAN><SPAN style="COLOR: #000000"> (HandlerType handler; handlers)<BR>                    handler ();<BR>                </SPAN><SPAN style="COLOR: #0000ff">foreach</SPAN><SPAN style="COLOR: #000000"> (FunctionType _function; functions)<BR>                    _function ();<BR>            }<BR>        }<BR>        </SPAN><SPAN style="COLOR: #0000ff">else</SPAN><SPAN style="COLOR: #000000"><BR>        {<BR>            Ret opCall ()<BR>            {<BR>                Ret ret;<BR>                </SPAN><SPAN style="COLOR: #0000ff">foreach</SPAN><SPAN style="COLOR: #000000"> (HandlerType handler; handlers)<BR>                    ret </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> handler ();<BR>                </SPAN><SPAN style="COLOR: #0000ff">foreach</SPAN><SPAN style="COLOR: #000000"> (FunctionType _function; functions)<BR>                    ret </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> _function ();<BR>                </SPAN><SPAN style="COLOR: #0000ff">return</SPAN><SPAN style="COLOR: #000000"> ret;<BR>            }<BR>        }<BR><BR>    }<BR>}<BR><BR>template Delegate(Ret, Arg1)<BR>{<BR>    </SPAN><SPAN style="COLOR: #0000ff">class</SPAN><SPAN style="COLOR: #000000"> Delegate<BR>    {<BR>        alias Ret </SPAN><SPAN style="COLOR: #0000ff">delegate</SPAN><SPAN style="COLOR: #000000"> (Arg1) HandlerType;<BR>        alias Ret function (Arg1) FunctionType;<BR>        mixin DelegateHandlers</SPAN><SPAN style="COLOR: #000000">!</SPAN><SPAN style="COLOR: #000000">(HandlerType, FunctionType);<BR><BR>        </SPAN><SPAN style="COLOR: #0000ff">static</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">if</SPAN><SPAN style="COLOR: #000000">(</SPAN><SPAN style="COLOR: #0000ff">is</SPAN><SPAN style="COLOR: #000000">(Ret: </SPAN><SPAN style="COLOR: #0000ff">void</SPAN><SPAN style="COLOR: #000000">))<BR>        {<BR>            </SPAN><SPAN style="COLOR: #0000ff">void</SPAN><SPAN style="COLOR: #000000"> opCall (Arg1 a1)<BR>            {<BR>                </SPAN><SPAN style="COLOR: #0000ff">foreach</SPAN><SPAN style="COLOR: #000000"> (HandlerType handler; handlers)<BR>                    handler (a1);<BR>                </SPAN><SPAN style="COLOR: #0000ff">foreach</SPAN><SPAN style="COLOR: #000000"> (FunctionType _function; functions)<BR>                    _function (a1);<BR>            }<BR>        }<BR>        </SPAN><SPAN style="COLOR: #0000ff">else</SPAN><SPAN style="COLOR: #000000"><BR>        {<BR>            Ret opCall (Arg1 a1)<BR>            {<BR>                Ret ret;<BR>                </SPAN><SPAN style="COLOR: #0000ff">foreach</SPAN><SPAN style="COLOR: #000000"> (HandlerType handler; handlers)<BR>                    ret </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> handler (a1);<BR>                </SPAN><SPAN style="COLOR: #0000ff">foreach</SPAN><SPAN style="COLOR: #000000"> (FunctionType _function; functions)<BR>                    ret </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> _function (a1);<BR>                </SPAN><SPAN style="COLOR: #0000ff">return</SPAN><SPAN style="COLOR: #000000"> ret;<BR>            }<BR>        }<BR><BR>    }<BR>}<BR><BR><BR></SPAN><SPAN style="COLOR: #0000ff">class</SPAN><SPAN style="COLOR: #000000"> Test<BR>{<BR>    </SPAN><SPAN style="COLOR: #0000ff">void</SPAN><SPAN style="COLOR: #000000"> test ()<BR>    {<BR>        writefln (</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">Test.test</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">);<BR>    }<BR>    </SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000"> test1 ()<BR>    {<BR>        writefln (</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">Test.test1</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">);<BR>        </SPAN><SPAN style="COLOR: #0000ff">return</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">1</SPAN><SPAN style="COLOR: #000000">;<BR>    }<BR>    </SPAN><SPAN style="COLOR: #0000ff">void</SPAN><SPAN style="COLOR: #000000"> test2(</SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000"> v)<BR>    {<BR>        writefln (</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">Test.test2</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">);<BR>    }<BR>    </SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000"> test3(</SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000"> v)<BR>    {<BR>        writefln (</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">Test.test3</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">);<BR>        </SPAN><SPAN style="COLOR: #0000ff">return</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">7</SPAN><SPAN style="COLOR: #000000">;<BR>    }<BR>}<BR><BR></SPAN><SPAN style="COLOR: #0000ff">void</SPAN><SPAN style="COLOR: #000000"> test_func ()<BR>{<BR>    writefln (</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">test_func</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">);<BR>}<BR></SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000"> test_func1 ()<BR>{<BR>    writefln (</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">test_func1</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">);<BR>    </SPAN><SPAN style="COLOR: #0000ff">return</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">2</SPAN><SPAN style="COLOR: #000000">;<BR>}<BR></SPAN><SPAN style="COLOR: #0000ff">void</SPAN><SPAN style="COLOR: #000000"> test_func2(</SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000"> v)<BR>{<BR>    writefln (</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">test_func2</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">);<BR>}<BR></SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000"> test_func3(</SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000"> v)<BR>{<BR>    writefln (</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">test_func3</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">);<BR>    </SPAN><SPAN style="COLOR: #0000ff">return</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">9</SPAN><SPAN style="COLOR: #000000">;<BR>}<BR><BR></SPAN><SPAN style="COLOR: #0000ff">void</SPAN><SPAN style="COLOR: #000000"> main()<BR>{<BR>    Test t </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">new</SPAN><SPAN style="COLOR: #000000"> Test;<BR><BR>    alias Delegate</SPAN><SPAN style="COLOR: #000000">!</SPAN><SPAN style="COLOR: #000000">(</SPAN><SPAN style="COLOR: #0000ff">void</SPAN><SPAN style="COLOR: #000000">) DDD;<BR>    DDD d </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">new</SPAN><SPAN style="COLOR: #000000"> DDD;<BR>    d </SPAN><SPAN style="COLOR: #000000">+=</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">&</SPAN><SPAN style="COLOR: #000000">t.test;<BR>    d </SPAN><SPAN style="COLOR: #000000">+=</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">&</SPAN><SPAN style="COLOR: #000000">test_func;<BR><BR>    d ();<BR><BR>    alias Delegate</SPAN><SPAN style="COLOR: #000000">!</SPAN><SPAN style="COLOR: #000000">(</SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000">) DDD1;<BR>    DDD1 d1 </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">new</SPAN><SPAN style="COLOR: #000000"> DDD1;<BR>    d1 </SPAN><SPAN style="COLOR: #000000">+=</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">&</SPAN><SPAN style="COLOR: #000000">t.test1;<BR>    d1 </SPAN><SPAN style="COLOR: #000000">+=</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">&</SPAN><SPAN style="COLOR: #000000">test_func1;<BR><BR>    </SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000"> a </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> d1 ();<BR>    assert (a </SPAN><SPAN style="COLOR: #000000">==</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">2</SPAN><SPAN style="COLOR: #000000">);<BR><BR>    alias Delegate</SPAN><SPAN style="COLOR: #000000">!</SPAN><SPAN style="COLOR: #000000">(</SPAN><SPAN style="COLOR: #0000ff">void</SPAN><SPAN style="COLOR: #000000">, </SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000">) DDD2;<BR>    DDD2 d2 </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">new</SPAN><SPAN style="COLOR: #000000"> DDD2;<BR>    d2 </SPAN><SPAN style="COLOR: #000000">+=</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">&</SPAN><SPAN style="COLOR: #000000">t.test2;<BR>    d2 </SPAN><SPAN style="COLOR: #000000">+=</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">&</SPAN><SPAN style="COLOR: #000000">test_func2;<BR><BR>    d2 (</SPAN><SPAN style="COLOR: #000000">1</SPAN><SPAN style="COLOR: #000000">);<BR><BR>    alias Delegate</SPAN><SPAN style="COLOR: #000000">!</SPAN><SPAN style="COLOR: #000000">(</SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000">, </SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000">) DDD3;<BR>    DDD3 d3 </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">new</SPAN><SPAN style="COLOR: #000000"> DDD3;<BR>    d3 </SPAN><SPAN style="COLOR: #000000">+=</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">&</SPAN><SPAN style="COLOR: #000000">t.test3;<BR>    d3 </SPAN><SPAN style="COLOR: #000000">+=</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">&</SPAN><SPAN style="COLOR: #000000">test_func3;<BR><BR>    </SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000"> b </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> d3 (</SPAN><SPAN style="COLOR: #000000">2</SPAN><SPAN style="COLOR: #000000">);<BR>    assert (b </SPAN><SPAN style="COLOR: #000000">==</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">9</SPAN><SPAN style="COLOR: #000000">);<BR>}<BR></SPAN></DIV><BR>闈炲父騫插噣錛岄潪甯哥畝媧侊紝涓嶆槸鍚楋紵榪欎釜鍙姳浜嗘垜10鍒嗛挓鏃墮棿鏉ュ啓銆傘傘?BR><BR>D璇█鐨勫鎵橀潪甯擱珮鏁堬紝鏈夊叴瓚g殑鍙互嫻嬭瘯涓涓嬮氳繃濮旀墭鍜岀洿鎺ヨ皟鐢ㄤ箣闂寸殑鎬ц兘宸埆銆備笂闈㈣繖涓嚜宸卞疄鐜扮殑澶氬垎媧懼鎵樼被錛屾晥鐜囦篃闈炲父楂橈紝鎴戠殑嫻嬭瘯緇撴灉鏄浜庢ц兘鐨勫獎鍝嶅嚑涔庡彲浠ュ拷鐣ャ傛兂璧烽偅涓巻灝藉崈杈涗竾鑻﹀疄鐜扮殑C錛嬶紜澶氬垎媧懼鎵樼被錛屽疄鐜板鏉傘佽皟璇曡垂鏃躲佽繍琛屾晥鐜囪繕寰堜綆錛屾瘡姣忎竴鎯沖埌榪欏績閲岄偅涓毦鍙楀晩銆傘傘傘?BR><BR>鍐嶆潵鐪嬩竴涓婦璇█寮哄ぇ鐨勯潤鎬佹鏌ユ満鍒訛細<BR><BR> <DIV style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><SPAN style="COLOR: #000000">template XXX (</SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000"> v)<BR>{<BR>    </SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000"> n </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> v;<BR>    </SPAN><SPAN style="COLOR: #0000ff">static</SPAN><SPAN style="COLOR: #000000"> assert (v </SPAN><SPAN style="COLOR: #000000">></SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">3</SPAN><SPAN style="COLOR: #000000">);<BR>}<BR><BR></SPAN><SPAN style="COLOR: #0000ff">void</SPAN><SPAN style="COLOR: #000000"> main ()<BR>{<BR>    </SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000"> n;<BR>    n </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> XXX</SPAN><SPAN style="COLOR: #000000">!</SPAN><SPAN style="COLOR: #000000">(</SPAN><SPAN style="COLOR: #000000">4</SPAN><SPAN style="COLOR: #000000">).n; </SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000"> OK</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #000000">    n </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> XXX</SPAN><SPAN style="COLOR: #000000">!</SPAN><SPAN style="COLOR: #000000">(</SPAN><SPAN style="COLOR: #000000">3</SPAN><SPAN style="COLOR: #000000">).n; </SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000"> 緙栬瘧閿欒</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #000000">}</SPAN></DIV><BR>鍚屾牱寰堟紓浜?BR><BR>濡傛灉浣犺寰楁彁紺轟俊鎭笉澶熷弸濂斤紝鍙互淇敼涓猴細<BR><BR> <DIV style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><SPAN style="COLOR: #000000">template XXX (</SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000"> v)<BR>{<BR>    </SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000"> n </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> v;<BR>    </SPAN><SPAN style="COLOR: #0000ff">static</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">if</SPAN><SPAN style="COLOR: #000000"> (v </SPAN><SPAN style="COLOR: #000000"><=</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">3</SPAN><SPAN style="COLOR: #000000">)<BR>        pragma (msg, </SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">template value must > 3</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">);<BR>    </SPAN><SPAN style="COLOR: #0000ff">static</SPAN><SPAN style="COLOR: #000000"> assert (v </SPAN><SPAN style="COLOR: #000000">></SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">3</SPAN><SPAN style="COLOR: #000000">);<BR>}</SPAN></DIV><BR>榪欐槸緙栬瘧鏃剁殑閿欒鎻愮ず錛?BR><BR>Compiling test.d ...<BR>template value must > 3<BR>D:\workspace\dace\test.d(94): static assert  (3 > 3) is false<BR>D:\workspace\dace\test.d(173): template instance test.XXX!(3) error instantiating<BR><BR>鎴戞兂浠ュ悗鏈夊彲鑳戒細鎵╁厖pragma錛屾敮鎸侀敊璇緭鍑猴紝榪欐牱灝變笉鐢ㄥ啓閲嶅鐨勮鍙ヤ簡錛屽彲浠ョ畝鍖栨垚榪欐牱錛?BR> <DIV style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><SPAN style="COLOR: #000000">template XXX (</SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000"> v)<BR>{<BR>    </SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000"> n </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> v;<BR>    </SPAN><SPAN style="COLOR: #0000ff">static</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">if</SPAN><SPAN style="COLOR: #000000"> (v </SPAN><SPAN style="COLOR: #000000"><=</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">3</SPAN><SPAN style="COLOR: #000000">)<BR>        pragma (error, </SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">template value must > 3</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">);<BR>}</SPAN></DIV><BR>榪欐牱鐪嬭搗鏉ユ洿濂姐備笉榪囩洰鍓嶆湁寰堝閲嶈鐗規ц瀹炵幇錛岃繖縐嶇帺鎰忓彲鑳借寰堜箙浠ュ悗鎵嶄細鍔犲叆浜嗐?img src ="http://www.shnenglu.com/cpunion/aggbug/1083.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/cpunion/" target="_blank">qiezi</a> 2005-11-11 17:13 <a href="http://www.shnenglu.com/cpunion/archive/2005/11/11/1083.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>D璇█璋冪敤ActiveX錛堝湪紿楀彛涓祵鍏ctiveX錛?/title><link>http://www.shnenglu.com/cpunion/archive/2005/11/11/1061.html</link><dc:creator>qiezi</dc:creator><author>qiezi</author><pubDate>Fri, 11 Nov 2005 04:16:00 GMT</pubDate><guid>http://www.shnenglu.com/cpunion/archive/2005/11/11/1061.html</guid><wfw:comment>http://www.shnenglu.com/cpunion/comments/1061.html</wfw:comment><comments>http://www.shnenglu.com/cpunion/archive/2005/11/11/1061.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.shnenglu.com/cpunion/comments/commentRss/1061.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/cpunion/services/trackbacks/1061.html</trackback:ping><description><![CDATA[     鎽樿: 榪欐槸涓涓粠C縐繪鍒癉鐨勪唬鐮侊紝鍘熸枃璇瘋鈥淓mbed an HTML control in your own window using plain C鈥濓紝瀹冪敤C緇撴瀯妯℃嫙浜嗚櫄琛紝騫朵笖瀹炵幇浜嗗涓帴鍙d互瀹屾垚瀵筗eb Browser鎺т歡鐨勮皟鐢ㄣ傚湪鐪嬪畬浠栫殑浠g爜涔嬪悗錛屾垜瀵逛簬COM/OLE鐨勪簡瑙e姞娣變簡涓浜涳紝浠ュ墠浣跨敤VC鍋氳繃COM鏂歸潰鐨勫簲鐢紝涔熺湅榪囦笉灝慍OM鏂歸潰鐨勪功錛屼笉榪囨病鏈夋秹鍙婂埌鐣岄潰錛屾墍浠ヤ竴鐩翠笉鐭ラ亾濡備綍鎶夾ctiv...  <a href='http://www.shnenglu.com/cpunion/archive/2005/11/11/1061.html'>闃呰鍏ㄦ枃</a><img src ="http://www.shnenglu.com/cpunion/aggbug/1061.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/cpunion/" target="_blank">qiezi</a> 2005-11-11 12:16 <a href="http://www.shnenglu.com/cpunion/archive/2005/11/11/1061.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>D璇█涓殑in/inout/out鍙傛暟http://www.shnenglu.com/cpunion/archive/2005/11/10/1044.htmlqieziqieziThu, 10 Nov 2005 06:51:00 GMThttp://www.shnenglu.com/cpunion/archive/2005/11/10/1044.htmlhttp://www.shnenglu.com/cpunion/comments/1044.htmlhttp://www.shnenglu.com/cpunion/archive/2005/11/10/1044.html#Feedback0http://www.shnenglu.com/cpunion/comments/commentRss/1044.htmlhttp://www.shnenglu.com/cpunion/services/trackbacks/1044.htmlprivate import std.stdio, std.process;

void test(int a, inout int b, out int c)
{
    writefln(a);
    writefln(b);
    writefln(c);
    a 
= 3;
    b 
= 5;
    c 
= 7;
}

void main ()
{
    
int a = 0, b = 1, c = 2;
    test(a, b, c);
    assert (a 
== 0);
    assert (b 
== 5);
    assert (c 
== 7);
    std.process.system(
"pause");
}

鍦ㄤ笂闈㈢殑渚嬪瓙閲岋紝紼嬪簭鍦╰est鍑芥暟涓殑杈撳嚭璇彞灝嗚緭鍑猴細
0
1
0
涔熷氨鏄錛宱ut鍙傛暟鍙栧兼槸鏃犳剰涔夌殑錛屽畠鍙敤浜庤祴鍊箋?BR>
榪欓噷鏈変竴涓緢澶х殑闂錛岃皟鐢╰est(a,b,c)鏃訛紝璋冪敤鑰呭浜巆鐨勫艱鏀瑰彉鍙兘姣棤鐭ヨ錛岀敋鑷蟲垚涓洪殣钘忓緢娣辯殑BUG銆傚姝わ紝璁稿浜哄緩璁姞寮烘鏌ワ紝姣斿鍦ㄨ皟鐢ㄦ椂錛屽繀欏繪寚鏄巌nout/out錛?BR>
test(a, inout b, out c);

浼間箮鑳藉璧峰埌涓浜涜紺轟綔鐢紝涓嶈繃榪欐牱涓鏉ワ紝璇硶涓婂掍笉鎬庝箞綆緇冧簡銆?img src ="http://www.shnenglu.com/cpunion/aggbug/1044.html" width = "1" height = "1" />

qiezi 2005-11-10 14:51 鍙戣〃璇勮
]]>
DMD鏈榪戠殑涓浜涙洿鏂?/title><link>http://www.shnenglu.com/cpunion/archive/2005/11/10/1039.html</link><dc:creator>qiezi</dc:creator><author>qiezi</author><pubDate>Thu, 10 Nov 2005 04:12:00 GMT</pubDate><guid>http://www.shnenglu.com/cpunion/archive/2005/11/10/1039.html</guid><wfw:comment>http://www.shnenglu.com/cpunion/comments/1039.html</wfw:comment><comments>http://www.shnenglu.com/cpunion/archive/2005/11/10/1039.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.shnenglu.com/cpunion/comments/commentRss/1039.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/cpunion/services/trackbacks/1039.html</trackback:ping><description><![CDATA[v0.138 瀹炵幇浜嗗瓧絎︿覆鐩存帴鍒囩墖璋冪敤錛?BR> <DIV style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><SPAN style="COLOR: #000000">    </SPAN><SPAN style="COLOR: #0000ff">char</SPAN><SPAN style="COLOR: #000000">[] a </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">abcde</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">[</SPAN><SPAN style="COLOR: #000000">2</SPAN><SPAN style="COLOR: #000000">..</SPAN><SPAN style="COLOR: #000000">3</SPAN><SPAN style="COLOR: #000000">];<BR>    writefln(a);<BR>    </SPAN><SPAN style="COLOR: #0000ff">char</SPAN><SPAN style="COLOR: #000000"> b </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">abcde</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">[</SPAN><SPAN style="COLOR: #000000">3</SPAN><SPAN style="COLOR: #000000">];<BR>    writefln(b);</SPAN></DIV><BR>鍙﹀淇浜嗕竴浜涚紪璇戝櫒鍜屾枃妗g敓鎴愮殑BUG銆?BR><BR>v0.137鐨勯噸瑕佹洿鏂版湁錛?BR>闅愬紡綾誨瀷寮曠敤錛?BR> <DIV style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><SPAN style="COLOR: #000000">auto c </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">abcde</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">;  </SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000"> c鍙橀噺鑷姩鑾峰緱綾誨瀷char[]</SPAN></DIV>extern(linkage)鍦ㄥ唴宓屽嚱鏁頒腑浣跨敤<BR> <DIV style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><SPAN style="COLOR: #0000ff">void</SPAN><SPAN style="COLOR: #000000"> test()<BR>{<BR>  </SPAN><SPAN style="COLOR: #0000ff">extern</SPAN><SPAN style="COLOR: #000000">(C) test1();<BR>}</SPAN></DIV><BR><BR>鍏跺畠鏇存柊鍒欎富瑕侀泦涓簬緙栬瘧鍣ㄥ伐浣溿佹枃妗e伐鍏楓佸簱絳夛紝鏆傛椂榪樻病鏈夌壒鍒護浜哄叴濂嬬殑鐗規у姞鍏ヨ繘鏉ワ紝姣斿錛歴tack tracing, relation api絳夈?img src ="http://www.shnenglu.com/cpunion/aggbug/1039.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/cpunion/" target="_blank">qiezi</a> 2005-11-10 12:12 <a href="http://www.shnenglu.com/cpunion/archive/2005/11/10/1039.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>D璇█浠や漢鍠滅埍鐨勫嚑涓湴鏂?/title><link>http://www.shnenglu.com/cpunion/archive/2005/11/02/902.html</link><dc:creator>qiezi</dc:creator><author>qiezi</author><pubDate>Wed, 02 Nov 2005 08:35:00 GMT</pubDate><guid>http://www.shnenglu.com/cpunion/archive/2005/11/02/902.html</guid><wfw:comment>http://www.shnenglu.com/cpunion/comments/902.html</wfw:comment><comments>http://www.shnenglu.com/cpunion/archive/2005/11/02/902.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/cpunion/comments/commentRss/902.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/cpunion/services/trackbacks/902.html</trackback:ping><description><![CDATA[1銆佸幓鎺変簡涓戦檵鐨勫畯銆?BR>C/C++涓殑瀹忔槸寰堜護浜哄帉鐑︾殑錛孌涓嶅厑璁稿啀浣跨敤瀹冦?BR><BR>2銆佸ソ鐢ㄧ殑瀛楃涓插父閲忚〃杈懼紡銆?BR>闄や簡綾籆鐨勪嬌鐢ㄥ弻寮曞彿鐨勫瓧絎︿覆甯擱噺琛ㄨ揪寮忎互澶栵紝榪樺彲浠ヤ嬌鐢╜瀛楃銆傚彲浠ヤ嬌鐢▁"68 65 6C6C 6F"鏉ヨ〃紺?hello"錛宺"ab\na"鍒欏拷鐣ュ瓧絎︿覆甯擱噺涓漿涔夊瓧絎︾殑杞箟浣滅敤錛岃繕鍙互鍦ㄥ瓧絎︿覆甯擱噺鍚庡姞涓奵, w鎴杁鏉ユ寚紺哄瓧絎︿覆甯擱噺鏄痗har[]綾誨瀷銆亀char[]綾誨瀷榪樻槸dchar[]綾誨瀷銆傚彲浠ヤ嬌鐢▇榪愮畻絎﹁繛鎺?涓瓧絎︿覆銆?BR><BR>3銆佹暟瀛椼?BR>鏁板瓧鍙互鐩存帴浣跨敤錛岃繕鍙互榪欐牱鏉ュ畾涔夛細int a = 3_029_301_000; 鏁板瓧鐩存帴閲?鍖呮嫭鏁存暟銆佹誕鐐規暟銆佸鏁?琛ㄨ揪寮忎腑錛屸淿鈥濆瓧絎︽槸琚拷鐣ョ殑銆傚彟澶栬繕鐩存帴鎻愪緵浜嗗鏁扮被鍨嬨?BR><BR>4銆佹彁渚涘畾闀挎暟緇勩佸彉闀挎暟緇勩佸叧鑱旀暟緇勩?BR>int[3] a瀹氫箟涓涓畾闀挎暟緇勶紱int [] a瀹氫箟涓涓彉闀挎暟緇勶紱int[int]瀹氫箟涓涓叧鑱旀暟緇勶紝閿被鍨嬫槸int錛屽肩被鍨嬫槸int錛沬nt[char[]] a瀹氫箟涓涓叧鑱旀暟緇勶紝閿被鍨嬫槸char[]錛屽肩被鍨嬫槸int錛屼嬌鐢ㄩ潪甯告柟渚褲?BR>鍙互浣跨敤foreach鏉ラ亶鍘嗘暟緇勶細<BR> <DIV style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><IMG src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align=top><SPAN style="COLOR: #0000ff">foreach</SPAN><SPAN style="COLOR: #000000"> (</SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000"> index, </SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000"> value; a)<BR><IMG src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align=top>  printf (</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">%d: %d\n</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">, index, value);<BR><IMG src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #0000ff">foreach</SPAN><SPAN style="COLOR: #000000"> (</SPAN><SPAN style="COLOR: #0000ff">char</SPAN><SPAN style="COLOR: #000000">[] key, </SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000"> value; a)<BR><IMG src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align=top>  printf (</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">%.*s: %d\n</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">, index, value);</SPAN></DIV><BR>鍙互浣跨敤in鎿嶄綔絎︽潵鍒ゆ柇鏌愪釜鍊兼槸鍚︽槸鍏寵仈鏁扮粍鐨勪竴涓敭錛?BR> <DIV style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><IMG src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align=top><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000">[</SPAN><SPAN style="COLOR: #0000ff">char</SPAN><SPAN style="COLOR: #000000">[]] a;<BR><IMG src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #0000ff">if</SPAN><SPAN style="COLOR: #000000"> (</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">hello</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">in</SPAN><SPAN style="COLOR: #000000"> a)<BR><IMG src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align=top>  writefln (</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">hello</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">);</SPAN></DIV><BR>鏁扮粍鍙互鍒囩墖(slice)錛?BR> <DIV style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><IMG src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align=top><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000">[] a; <BR><IMG src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000">[] b </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> a[</SPAN><SPAN style="COLOR: #000000">1</SPAN><SPAN style="COLOR: #000000">..</SPAN><SPAN style="COLOR: #000000">3</SPAN><SPAN style="COLOR: #000000">]; <BR><IMG src="http://www.shnenglu.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000">[] c </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> a[</SPAN><SPAN style="COLOR: #000000">1</SPAN><SPAN style="COLOR: #000000">..length];</SPAN></DIV><BR>絳夌瓑銆傘傘傘?BR><BR>5銆佸叾瀹冭繕鏀寔濮旀墭銆佸嚱鏁版寚閽堛佹ā鏉褲佸紓甯搞丷AII銆佸綰﹀紡緙栫▼銆佸崟鍏冩祴璇曘亀ith璇彞銆乤uto/typeof銆佸瀮鍦懼洖鏀躲佹搷浣滅閲嶈澆銆佸唴鑱旀眹緙栥佹潯浠剁紪璇戙佸祵鍏ュ埌HTML絳夛紝瀹冭繕鏍囧噯鍖栦簡ABI(榪欐槸C/C++鏈璁╀漢澶寸棝鐨勫湴鏂逛箣涓)銆傝繖浜涚壒鎬уぇ閮ㄥ垎閮芥瘮杈冪啛鎮夊拰瀹炵敤錛屼笅闈㈢畝鍗曚粙緇嶄竴涓嬫潯浠剁紪璇戝拰宓屽叆鍒癏TML銆?BR><BR>6銆佹潯浠剁紪璇戙?BR>鍦―涓紝鍙互浣跨敤version(VersionID)鏉ヨ繘琛屾潯浠剁紪璇戯細<BR> <DIV style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><SPAN style="COLOR: #000000">version (Win32)<BR>{<BR>  </SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000"><IMG src="http://www.shnenglu.com/images/dot.gif"></SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #000000">}<BR></SPAN><SPAN style="COLOR: #0000ff">else</SPAN><SPAN style="COLOR: #000000"><BR>{<BR>  </SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">..</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #000000">}</SPAN></DIV><BR>榪樺彲浠ヤ嬌鐢╠ebug鏉′歡錛?BR> <DIV style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><SPAN style="COLOR: #000000">debug<BR>{<BR>  </SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000"><IMG src="http://www.shnenglu.com/images/dot.gif"></SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #000000">}<BR></SPAN><SPAN style="COLOR: #0000ff">else</SPAN><SPAN style="COLOR: #000000"><BR>{<BR>  </SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000"><IMG src="http://www.shnenglu.com/images/dot.gif"></SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #000000">}</SPAN></DIV><BR>鎴栬咃細<BR>debug printf ("hello");<BR>闈欐佹潯浠剁紪璇戯細<BR> <DIV style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><SPAN style="COLOR: #0000ff">const</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000"> n</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">1</SPAN><SPAN style="COLOR: #000000">;<BR></SPAN><SPAN style="COLOR: #0000ff">static</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #0000ff">if</SPAN><SPAN style="COLOR: #000000"> (n </SPAN><SPAN style="COLOR: #000000">==</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">1</SPAN><SPAN style="COLOR: #000000">)<BR>  writefln (</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">hello</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">);<BR></SPAN><SPAN style="COLOR: #0000ff">else</SPAN><SPAN style="COLOR: #000000"><BR>  writefln (</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">world</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">);</SPAN></DIV><BR>綾誨瀷媯鏌ワ細<BR> <DIV style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000"> n </SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000"> </SPAN><SPAN style="COLOR: #000000">3</SPAN><SPAN style="COLOR: #000000">;<BR></SPAN><SPAN style="COLOR: #0000ff">if</SPAN><SPAN style="COLOR: #000000"> (</SPAN><SPAN style="COLOR: #0000ff">is</SPAN><SPAN style="COLOR: #000000">(n[]))<BR>  writefln (</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">like array</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">);<BR></SPAN><SPAN style="COLOR: #0000ff">if</SPAN><SPAN style="COLOR: #000000"> (</SPAN><SPAN style="COLOR: #0000ff">is</SPAN><SPAN style="COLOR: #000000">(n:</SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000">))<BR>  writefln (</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">is an integer</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">);</SPAN></DIV><BR><BR>7銆佸祵鍏TML銆?BR>鍦ㄤ竴涓狧TML鏂囦歡涓紝<code>鍜?lt;/code>涔嬮棿鐨勯儴鍒嗗彲浠ュ綋浣淒浠g爜鏉ョ紪璇戙傛瘮濡備笅闈㈣繖孌典唬鐮侊細<BR> <DIV style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><SPAN style="COLOR: #0000ff"><</SPAN><SPAN style="COLOR: #800000">h1</SPAN><SPAN style="COLOR: #0000ff">></SPAN><SPAN style="COLOR: #000000">This is a test</SPAN><SPAN style="COLOR: #0000ff"></</SPAN><SPAN style="COLOR: #800000">h1</SPAN><SPAN style="COLOR: #0000ff">></SPAN><SPAN style="COLOR: #000000"><BR></SPAN><SPAN style="COLOR: #0000ff"><</SPAN><SPAN style="COLOR: #800000">code</SPAN><SPAN style="COLOR: #0000ff">></SPAN><SPAN style="COLOR: #000000"><BR>import std.c.stdio;<BR><BR>int </SPAN><SPAN style="COLOR: #0000ff"><</SPAN><SPAN style="COLOR: #800000">font </SPAN><SPAN style="COLOR: #ff0000">size</SPAN><SPAN style="COLOR: #0000ff">=+1</SPAN><SPAN style="COLOR: #0000ff">><</SPAN><SPAN style="COLOR: #800000">b</SPAN><SPAN style="COLOR: #0000ff">></SPAN><SPAN style="COLOR: #000000">main</SPAN><SPAN style="COLOR: #0000ff"></</SPAN><SPAN style="COLOR: #800000">b</SPAN><SPAN style="COLOR: #0000ff">></</SPAN><SPAN style="COLOR: #800000">font</SPAN><SPAN style="COLOR: #0000ff">></SPAN><SPAN style="COLOR: #000000">()<BR>{<BR></SPAN><SPAN style="COLOR: #ff0000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff"><</SPAN><SPAN style="COLOR: #800000">span </SPAN><SPAN style="COLOR: #ff0000">style</SPAN><SPAN style="COLOR: #0000ff">="color:red"</SPAN><SPAN style="COLOR: #0000ff">></SPAN><SPAN style="COLOR: #000000">printf</SPAN><SPAN style="COLOR: #0000ff"></</SPAN><SPAN style="COLOR: #800000">span</SPAN><SPAN style="COLOR: #0000ff">></SPAN><SPAN style="COLOR: #000000">(</SPAN><SPAN style="COLOR: #0000ff"><</SPAN><SPAN style="COLOR: #800000">u</SPAN><SPAN style="COLOR: #0000ff">></SPAN><SPAN style="COLOR: #ff0000">&quot;</SPAN><SPAN style="COLOR: #000000">hello world\n</SPAN><SPAN style="COLOR: #ff0000">&quot;</SPAN><SPAN style="COLOR: #0000ff"></</SPAN><SPAN style="COLOR: #800000">u</SPAN><SPAN style="COLOR: #0000ff">></SPAN><SPAN style="COLOR: #000000">);<BR></SPAN><SPAN style="COLOR: #ff0000">&nbsp;</SPAN><SPAN style="COLOR: #000000">return 0;<BR>}<BR></SPAN><SPAN style="COLOR: #0000ff"></</SPAN><SPAN style="COLOR: #800000">code</SPAN><SPAN style="COLOR: #0000ff">></SPAN><SPAN style="COLOR: #000000"><BR></SPAN><SPAN style="COLOR: #0000ff"><</SPAN><SPAN style="COLOR: #800000">hr </SPAN><SPAN style="COLOR: #0000ff">/></SPAN><SPAN style="COLOR: #000000"><BR></SPAN><SPAN style="COLOR: #0000ff"><</SPAN><SPAN style="COLOR: #800000">h1</SPAN><SPAN style="COLOR: #0000ff">></SPAN><SPAN style="COLOR: #000000"> End </SPAN><SPAN style="COLOR: #0000ff"></</SPAN><SPAN style="COLOR: #800000">h1</SPAN><SPAN style="COLOR: #0000ff">></SPAN></DIV><BR>鎶婂畠瀛樺偍涓篐TML鏂囦歡錛屽彲浠ョ洿鎺ヤ嬌鐢╠md緙栬瘧鍣ㄧ紪璇戙?img src ="http://www.shnenglu.com/cpunion/aggbug/902.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/cpunion/" target="_blank">qiezi</a> 2005-11-02 16:35 <a href="http://www.shnenglu.com/cpunion/archive/2005/11/02/902.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>閰嶇疆D璇█緙栫▼鐜http://www.shnenglu.com/cpunion/archive/2005/11/02/892.htmlqieziqieziWed, 02 Nov 2005 03:17:00 GMThttp://www.shnenglu.com/cpunion/archive/2005/11/02/892.htmlhttp://www.shnenglu.com/cpunion/comments/892.htmlhttp://www.shnenglu.com/cpunion/archive/2005/11/02/892.html#Feedback14http://www.shnenglu.com/cpunion/comments/commentRss/892.htmlhttp://www.shnenglu.com/cpunion/services/trackbacks/892.html
D璇█鐨勪粙緇嶆渶濂芥槸鐪?A >uframer鐨刡log錛屼粬緲昏瘧浜咲璇█鐨勫ぇ閮ㄥ垎鏂囨。銆傚綋鐒剁敱浜嶥璇█鐩墠涓鐩村浜庢祴璇曠増錛屾枃妗e拰鏈鏂扮殑緙栬瘧鍣ㄤ箣闂村彲鑳芥湁寰堝涓嶄竴鑷淬?BR>
D璇█鐨勭紪璇戝櫒鐩墠鏈?涓紝DMD鍜孏DC錛孌MD姣旇緝瀹規槗閰嶇疆錛屽彲浠ヤ粠http://www.digitalmars.com/d/dcompiler.html涓嬭澆鏈鏂扮増銆備笅杞界殑鍘嬬緝鍖呯洿鎺ヨВ鍘嬪埌浠繪剰涓涓垎鍖虹殑鏍圭洰褰曪紝騫舵妸\dm\bin鍜孿dmd\bin鍔犲埌PATH鐜鍙橀噺閲屽嵆鍙嬌鐢ㄣ?BR>
鍐欎竴涓畝鍗曠殑D璇█紼嬪簭錛屽綋鐒惰繕鏄粡鍏哥殑HelloWorld紼嬪簭錛?BR>
void main ()
{
    printf (
"Hello world!\n");
}

鍜孋紼嬪簭鍩烘湰涓婁竴鏍楓傛妸瀹冧繚瀛樹負hello_world.d銆?BR>
涓嬮潰鐩存帴鍦ㄨ繖涓簮鏂囦歡鎵鍦ㄧ殑鐩綍涓嬶紝鎵цdmd hello_world.d錛屽嵆鍙紪璇戝嚭hello_world.exe錛屾墽琛屽畠灝辮兘鍦ㄦ帶鍒跺彴鎵撳嵃鍑篐ello world!銆?BR>
鎺ヤ笅鏉ュ埌http://www.dsource.org/projects/build/涓嬭澆build紼嬪簭錛岃繖鏄湪D紺懼尯浣跨敤姣旇緝騫挎硾鐨勪竴涓▼搴忋傜敱浜庢渶鏂扮殑v2.09鐗堝凡緇忓彂鐜頒簡涓浜涗弗閲嶇殑BUG錛屾墍浠ユ渶濂藉埌http://svn.dsource.org/projects/build/downloads/涓嬭澆v2.08鐗堛傛妸涓嬭澆鐨?exe鏂囦歡鏀瑰悕涓篵uild.exe騫舵斁緗悎閫傜殑鏂囦歡澶逛笅錛屽茍璁劇疆PATH鐜鍙橀噺銆?涓虹畝鍗曡搗瑙佹垜鏄洿鎺ユ妸瀹冩斁鍦╘dm\bin鏂囦歡澶逛笅)

涓嬮潰嫻嬭瘯涓涓媌uild紼嬪簭錛岀紪鍐欎竴涓猦ello_world.brf鏂囦歡錛屼繚瀛樺湪hello_world.d鍚屼竴璺緞涓嬶紝鏂囦歡鍐呭濡備笅錛?BR>
-cleanup
hello_world.d


鐒跺悗鎵цbuild @hello_world鍗沖彲緙栬瘧鍑篽ello_world.exe銆?/P>

akIDE鏄竴涓狣璇█鐨処DE錛屽彲浠ュ埌http://www.lessequal.com/akide涓嬭澆錛屽畠鍙渶瑕丏MD鏀寔銆?BR>
D璇█緙栬瘧閫熷害闈炲父蹇?榪欎篃鏄疻alter Bright瀵笴++涓嶆弧鐨勪竴涓噸瑕佸師鍥?銆俤source.org涓殑mango欏圭洰鍖呭惈755涓狣婧愭枃浠訛紝浣嗗湪鎴戠殑鏈哄櫒涓婄紪璇戞垚.lib鏂囦歡鍙渶瑕?縐掓椂闂淬?BR>
D璇█鎬ц兘涔熷緢涓嶉敊錛屾湁2綃嘍璇█鍜孋/C++銆丣ava銆丆#鐨勬ц兘姣旇緝鏂囩珷錛?A >
http://mag.vchelp.net/200312/fanyi.htm
http://mag.vchelp.net/200312/fanyi_2.htm

鐩稿叧欏圭洰浠嬬粛錛?BR>mango: 榪欐槸涓涓笓娉ㄤ簬鏈嶅姟绔紪紼嬬殑欏圭洰錛岀洰鍓嶄富瑕佺敱Kris寮鍙戙佺淮鎶わ紝瀹炵幇浜唖ervlet錛屾殏鏃惰繕娌℃湁澶鏉傜殑鍔熻兘錛屼笉榪囧緢鍊煎緱鏈熷緟銆?BR>dwt: D璇█鐨剆wt寮鍙戝寘錛岀晫闈㈠紑鍙戦閫夈傜湅榪噀clipse鐣岄潰鐨勫簲璇ユ湁姣旇緝娣辯殑鍗拌薄銆傜敱浜庡ぇ閮ㄥ垎浠g爜鏄粠java浠g爜杞崲榪囨潵鐨勶紝鎵浠ョ被鍚嶃佹帴鍙g瓑閮芥病鏈夋敼鍙樸?BR>dui: D璇█鐨勫埆涓涓晫闈㈠紑鍙戝寘錛屽熀浜嶨TK銆?BR>build: 涓婇潰浠嬬粛榪囩殑build宸ュ叿銆?BR>dcoder: 鍩轟簬vs.net鐨凞璇█璇硶楂樹寒鎻掍歡銆?BR>dsp: 鍏ㄧО鏄疍ynamic Servlet Pages銆?BR>
浠ヤ笂欏圭洰閮藉彲浠ュ湪http://www.dsource.org/projects/鎵懼埌璇︾粏璧勬枡銆?BR>
DMDScript鏄竴涓被浼間簬JavaScript鐨勮剼鏈郴緇燂紝鍙互鍦?A >http://www.digitalmars.com/dscript/鎵懼埌璇︾粏璧勬枡錛岃繖涓垜榪樻病鏈変嬌鐢ㄨ繃銆?BR>

鏈鍚庨檮涓?涓嬌鐢╠wt寮鍙戠殑鐣岄潰(娉細鐢變簬鏈漢涓嶄範鎯畨瑁呮潃姣掕蔣浠訛紝涓嬭澆璇峰厛鏉姣?錛?/FONT>
1銆佷豢eclipse鐣岄潰錛?BR>http://www.shnenglu.com/Files/cpunion/dummyeclipse.rar
2銆乨wt鎺т歡婕旂ず錛?BR>http://www.shnenglu.com/Files/cpunion/controlexample.rar

鍦╳indows xp涓婚涓嬫晥鏋滄瘮杈冨ソ銆傝繖2涓▼搴忓湪鎴戠殑鏈哄櫒涓婂垎鍒彧鍗?.4M鍜?.2M鍐呭瓨錛屽惎鍔ㄦ椂闂翠篃涓嶈凍1縐掞紝涓嶈琚玡clipse鐨勫惎鍔ㄦ椂闂村悡鍧忎簡銆?BR>



鎵懼埌浜嗚繖2寮犲浘錛?BR>controlexample.pngdummyeclipse.png



qiezi 2005-11-02 11:17 鍙戣〃璇勮
]]>
久久亚洲AV成人出白浆无码国产| 国产婷婷成人久久Av免费高清| 色欲久久久天天天综合网精品| 精品无码人妻久久久久久| 久久久青草久久久青草| 精品久久久久久久| 情人伊人久久综合亚洲| 欧美日韩中文字幕久久伊人| 国产精品九九久久精品女同亚洲欧美日韩综合区 | 久久久久国产一区二区三区| 91久久精品国产91性色也| 99久久人人爽亚洲精品美女| 久久精品国产亚洲av瑜伽| 精品免费久久久久国产一区| 久久久WWW成人免费毛片| 无码精品久久一区二区三区 | 一本色综合久久| 欧洲人妻丰满av无码久久不卡| 69国产成人综合久久精品| 国产精品伊人久久伊人电影| 亚洲欧洲久久av| 久久综合九色综合网站| 国产激情久久久久影院老熟女| 久久91精品国产91| 国产成人精品久久| 国内精品伊人久久久久| 国产亚洲色婷婷久久99精品91| 久久久久久久女国产乱让韩| 国产精品久久一区二区三区 | 国产精品gz久久久| 伊人久久亚洲综合影院| 国产精品久久久久久福利漫画| 国产日韩久久久精品影院首页| 久久综合亚洲色一区二区三区| 国产欧美久久久精品| 亚洲国产高清精品线久久| 久久国产色AV免费看| 久久久久亚洲AV无码去区首| 久久婷婷五月综合色高清 | 久久久国产打桩机| 国内精品久久久久久久涩爱|