锘??xml version="1.0" encoding="utf-8" standalone="yes"?>99久久无码一区人妻,777米奇久久最新地址,亚洲欧洲精品成人久久曰影片 http://www.shnenglu.com/dragon/category/8159.htmlDragon zh-cn Sat, 01 Jan 2011 20:06:39 GMT Sat, 01 Jan 2011 20:06:39 GMT 60 offset(type,member)鐨勬帰璁?/title> http://www.shnenglu.com/dragon/archive/2011/01/01/137828.htmlDragon Dragon Sat, 01 Jan 2011 03:00:00 GMT http://www.shnenglu.com/dragon/archive/2011/01/01/137828.html http://www.shnenglu.com/dragon/comments/137828.html http://www.shnenglu.com/dragon/archive/2011/01/01/137828.html#Feedback 0 http://www.shnenglu.com/dragon/comments/commentRss/137828.html http://www.shnenglu.com/dragon/services/trackbacks/137828.html 榪欎唬鐮佹槸鍙傜収鍒漢鐨勬枃绔犲啓鐨勶紝鍙緵鑷繁鐞嗚В鐢紝鏈夊叴瓚g殑涔熷彲浠ョ湅鐪嬨?br>鍦板潃錛?a >http://eulertao.ycool.com/post.1762422.html #include <cstdlib> #include <iostream> using namespace std; #define offset(type,member) ((int)&(((type*)0)->member)) /* 鍗沖亣璁?鍦板潃鏄痵綾誨瀷鐨勪竴涓疄渚嬶紝鍒欐垚鍛樺彉閲弇鐨勫湴鍧搴旇鏄紵 搴斾負(fù)璧峰鍦板潃鏄?錛屾墍浠ユ眰鍑虹殑鍦板潃涔熷氨鍙互鐩存帴鐪嬩綔鏄亸縐婚噺 */ typedef void func(char *);
typedef struct mystu { char * str; func * f; }mystu_t;
void print(char * str) { printf("[%s]\n",str); }
int main(int argc, char *argv[]) { mystu_t t; t.str="This is a expriment"; t.f=print; int offs=offset(mystu_t,f); printf("&t=0x%x &t.f=0x%x offset=%d t.f=0x%x &print=0x%x\n",&t,&t.f,offs,t.f,&print); //t.f鏄嚱鏁板湪鍐呭瓨鐨勫疄闄呭湴鍧錛岃?amp;(t.f)鏄痶涓繚瀛樿繖涓嚱鏁板湴鍧鐨勫湴鍧銆?br> /* &t-------> -------------- 鍦板潃 -->0x22ff70 鍦ㄦ垜緙栬瘧騫沖彴&t涓?0x22ff70 | char* |鍐呭 -->"This is a expriment" &t.f-----> -------------- 鍦板潃 -->0x22ff74 鍦ㄦ垜緙栬瘧騫沖彴&t.f涓?0x22ff74 | func* |鍐呭 -->0x401390 鏄痶.f(print)鐨勫疄闄呭湴鍧,鍦ㄦ垜緙栬瘧騫沖彴t.f涓?0x401390 -------------- */ func * f1=*(func**)(((int)&t)+offs);//t+offs鏄痶.f鐨勫湴鍧,閭e氨鏄痜unc * 鐨勫湴鍧 錛宨nt璧蜂互杞肩殑浣滅敤 /* &t-----------------> -------------- 鍦板潃 -->0x22ff70 鍦ㄦ垜緙栬瘧騫沖彴&t涓?0x22ff70 | char* |鍐呭 -->"This is a expriment" ((int)&t)+offs-----> -------------- 鍦板潃 -->0x22ff74 鍦ㄦ垜緙栬瘧騫沖彴&t.f涓?0x22ff74 | func* |鍐呭 -->0x401390 鏄痶.f(print)鐨勫疄闄呭湴鍧,鍦ㄦ垜緙栬瘧騫沖彴t.f涓?0x401390 -------------- 鍙互鐪嬪嚭 ((int)&t)+offs灝辨槸淇濆瓨print鍦板潃鐨勫湴鍧錛屼絾緙栬瘧鍣ㄤ笉鑳界洿鎺ョ敤*瀵瑰畠鍙栧鹼紝 鎴戜滑鐭ラ亾浜?jiǎn)瀹冩槸print鍦板潃鐨勫湴鍧鍚庯紝灝卞彲浠ュ皢瀹冨己鍒惰漿鎹㈡垚func **,鐒跺悗瀵瑰畠鍙栧鹼紝灝辨槸func * */ printf("real func addr = 0x%x\n", f1); f1(t.str); system("PAUSE"); return EXIT_SUCCESS; } 鏂囦歡鍦ㄨ繖閲岋紝涓嬭澆鏉ョ湅姣旇緝娓呮錛?br>浠g爜鏂囦歡
]]>Base64鍔犲瘑瑙e瘑浠嶭ive555涓彁鍙?C++) http://www.shnenglu.com/dragon/archive/2010/12/14/136375.htmlDragon Dragon Tue, 14 Dec 2010 06:10:00 GMT http://www.shnenglu.com/dragon/archive/2010/12/14/136375.html http://www.shnenglu.com/dragon/comments/136375.html http://www.shnenglu.com/dragon/archive/2010/12/14/136375.html#Feedback 0 http://www.shnenglu.com/dragon/comments/commentRss/136375.html http://www.shnenglu.com/dragon/services/trackbacks/136375.html 闃呰鍏ㄦ枃 ]]> 鎴愬憳鍑芥暟鎸囬拡鏄惁鐢╰ypedef鐨勫尯鍒?/title> http://www.shnenglu.com/dragon/archive/2010/12/02/135256.htmlDragon Dragon Thu, 02 Dec 2010 03:35:00 GMT http://www.shnenglu.com/dragon/archive/2010/12/02/135256.html http://www.shnenglu.com/dragon/comments/135256.html http://www.shnenglu.com/dragon/archive/2010/12/02/135256.html#Feedback 0 http://www.shnenglu.com/dragon/comments/commentRss/135256.html http://www.shnenglu.com/dragon/services/trackbacks/135256.html /**/ /* *嫻嬭瘯鎴愬憳鍑芥暟鎸囬拡鐨勫皬紼嬪簭,鏈塼ypedef涓庢病鏈塼ypedef鐨勫尯鍒?br> */ #include < iostream > using namespace std; class Test { public : Test(); ~ Test(); private : void add5() { res += 5 ;} void add6() { res += 6 ;} typedef void (Test:: * add_5)(); // 鐜板湪add_5鏄竴涓被鍨嬩簡(jiǎn) add_5 p_add_5; // p_add_5鎵嶆槸涓涓嚱鏁版寚閽?/span> void (Test:: * add_6)(); // 鐜板湪add_6鏄竴涓嚱鏁版寚閽堝彉閲?/span>public : void DoAddAction(); void Display(); private : int res; } ; Test::Test() { p_add_5 =& Test::add5; // 娉ㄦ剰榪欓噷鐨勫啓娉?/span> add_6 =& Test::add6; // 鏃犺鍦ㄧ被澶栬繕鏄被鍐咃紝榪欎釜&閮戒笉鑳藉皯 res = 0 ; } Test::~ Test() { } void Test::DoAddAction() { ( this ->* p_add_5)(); // 浣跨敤綾繪垚鍛樺嚱鏁版寚閽堝繀欏繪湁“->*”鎴?#8220;.*”鐨勮皟鐢?/span> ( this ->* add_6)(); } void Test::Display() { cout << " The res is: " << res << endl; } int main() { Test * test = new Test(); test -> DoAddAction(); test -> Display(); delete test; return 0 ; }
]]> 鎴愬憳鍑芥暟鎸囬拡鏁扮粍 http://www.shnenglu.com/dragon/archive/2010/12/02/135250.htmlDragon Dragon Thu, 02 Dec 2010 03:04:00 GMT http://www.shnenglu.com/dragon/archive/2010/12/02/135250.html http://www.shnenglu.com/dragon/comments/135250.html http://www.shnenglu.com/dragon/archive/2010/12/02/135250.html#Feedback 0 http://www.shnenglu.com/dragon/comments/commentRss/135250.html http://www.shnenglu.com/dragon/services/trackbacks/135250.html /**/ /* *嫻嬭瘯鎴愬憳鍑芥暟鎸囬拡鏁扮粍鐨勫皬紼嬪簭 */ #include < iostream > using namespace std; class Test { public : Test(); ~ Test(); private : void add5() { res += 5 ;} void add6() { res += 6 ;} void (Test:: * add[ 2 ])(); // 榪欎釜2鑷沖叧閲嶈錛屽湪VC涓嬫病鍐欎細(xì)鎶ラ敊錛屼絾鍦≦T閲屾病鎶ワ紝浣嗘瀽鏋勬椂鍑洪敊錛?/span>public : void DoAddAction(); void Display(); private : int res; } ; Test::Test() { add[ 0 ] =& Test::add5; // 娉ㄦ剰榪欓噷鐨勫啓娉?/span> add[ 1 ] =& Test::add6; res = 0 ; } Test::~ Test() { } void Test::DoAddAction() { for ( int i = 0 ;i < 2 ;i ++ ) { ( this ->* add[i])(); // 浣跨敤綾繪垚鍛樺嚱鏁版寚閽堝繀欏繪湁“->*”鎴?#8220;.*”鐨勮皟鐢?/span> } }void Test::Display() { cout << " The res is: " << res << endl; } int main() { Test * test = new Test(); test -> DoAddAction(); test -> Display(); delete test; return 0 ; }
]]>鍔ㄦ佸垱寤虹殑浜岀淮鏁扮粍涓庝簩緇存暟緇?/title> http://www.shnenglu.com/dragon/archive/2008/12/12/69304.htmlDragon Dragon Fri, 12 Dec 2008 15:26:00 GMT http://www.shnenglu.com/dragon/archive/2008/12/12/69304.html http://www.shnenglu.com/dragon/comments/69304.html http://www.shnenglu.com/dragon/archive/2008/12/12/69304.html#Feedback 0 http://www.shnenglu.com/dragon/comments/commentRss/69304.html http://www.shnenglu.com/dragon/services/trackbacks/69304.html 鍏堢湅鐪嬩互涓嬩唬鐮?鏄姩澶垱寤轟竴涓簩緇存暟緇刟[3][4] int **a; a=new int*[3]; for(int i=0;i<3;i++) { a[i]=new int[4]; } 榪欐槸鎴戣皟璇曟椂鍓笅鏉ョ殑鍥? 鍓嶉潰涓夎鏄瘡琛岀殑棣栧湴鍧,鍒嗗埆鏄?amp;a[0],&a[1],&a[2] &a[0][0]鍒?amp;a[0][3]鏄涓琛屽厓绱犵殑鍦板潃 &a[1][0]鍒?amp;a[1][3]鏄浜岃鍏冪礌鐨勫湴鍧 0x00372680-0x00372628=0x00000058 0x003726d8-0x00372680=0x00000058 鍙,絎竴琛屽拰絎簩琛?絎簩琛屽拰絎笁琛岀浉闅?8(0x00000058)涓瓧鑺?br>鍙互鐪嬪嚭琛屼笌琛屼箣闂存槸涓嶈繛緇殑! 鍐嶇湅琛岄噷鐨? 0x0037262c-0x00372628=0x00000004 0x00372630-0x0037262c=0x00000004 0x00372634-0x00372630=0x00000004 閮芥槸鐩擱殧4(0x00000004)涓瓧鑺?鍦ㄦ垜鐨勭數(shù)鑴戦噷鏁村瀷鏄崰4涓瓧鑺? 鍙互鐪嬪嚭琛岄噷鏄繛緇偍瀛樼殑! 鍐嶇湅鎴戣繖浠g爜(浠ョ涓琛屼負(fù)渚?: int a[3][4]; 璋冭瘯鏃跺壀涓嬫潵鐨勫浘: 鍥劇殑璇存槑涓庡墠闈竴鏍? 0x0012ff60-0x0012ff50=0x00000010 0x0012ff70-0x0012ff60=0x00000010 鍙,絎竴琛屽拰絎簩琛?絎簩琛屽拰絎笁琛岀浉闅?6(0x00000010)涓瓧鑺?br>涓琛屾湁4涓暣鍨嬪厓绱?涓涓?瀛楄妭,鍒氬ソ鏄?6瀛楄妭. 鍙琛屼笌琛屼箣闂存槸榪炵畫鐨? 浣犺繕鍙互浠?amp;a[0][3]涓?amp;a[1][0]鐩擱殧鐨勫瓧鑺傛暟鐪嬪嚭鏉? 0x0012ff60-0x0012ff5c=0x00000004 鍒氬ソ絎竴琛屾湭鎺ヤ笅鏉ュ氨鏄浜岃鐨勫紑濮? 鍐嶇湅琛岄噷鐨?浠ョ涓琛屼負(fù)渚?: 0x0012ff54-0x0012ff50=0x00000004 0x0012ff58-0x0012ff54=0x00000004 0x0012ff5c-0x0012ff58=0x00000004 鍙互鐪嬪嚭琛岄噷涔熸槸榪炵畫鍌ㄥ瓨鐨? 鎬葷粨:鍔ㄦ佸垱寤虹殑浜岀淮鏁扮粍鐨勮涓庤涔嬮棿鐨勫湴鍧鏄笉榪炵畫鐨?琛岄噷鍏冪礌鐨勫湴鍧鏄繛緇殑! 鑰岄潤(rùn)鎬佸垱寤虹殑浜岀淮鏁扮粍鐨勮涓庤涔嬮棿鐨勫湴鍧鏄繛緇殑,琛岄噷鍏冪礌鐨勫湴鍧涔熸槸榪炵畫鐨? 鎵浠ョ敤鍦板潃鑷鎴栧湴鍧+鏍囧彿璁塊棶鍏冪礌鏃惰灝忓績(jī)! ]]> void鎸囬拡 http://www.shnenglu.com/dragon/archive/2008/09/02/60760.htmlDragon Dragon Tue, 02 Sep 2008 12:17:00 GMT http://www.shnenglu.com/dragon/archive/2008/09/02/60760.html http://www.shnenglu.com/dragon/comments/60760.html http://www.shnenglu.com/dragon/archive/2008/09/02/60760.html#Feedback 7 http://www.shnenglu.com/dragon/comments/commentRss/60760.html http://www.shnenglu.com/dragon/services/trackbacks/60760.html 鍦板潃鍜?font style="LINE-HEIGHT: 1.3em" color=#ff0000>闀垮害 浣嗘槸鎸囬拡鍙瓨鍌ㄥ湴鍧,闀垮害鍒欏彇鍐充簬鎸囬拡鐨勭被鍨? 緙栬瘧鍣ㄦ牴鎹寚閽堢殑綾誨瀷浠庢寚閽堟寚鍚戠殑鍦板潃鍚戝悗瀵誨潃 鎸囬拡綾誨瀷涓嶅悓鍒欏鍧鑼冨洿涔熶笉鍚?姣斿: int*浠庢寚瀹氬湴鍧鍚戝悗瀵繪壘4瀛楄妭浣滀負(fù)鍙橀噺鐨勫瓨鍌ㄥ崟鍏? double*浠庢寚瀹氬湴鍧鍚戝悗瀵繪壘8瀛楄妭浣滀負(fù)鍙橀噺鐨勫瓨鍌ㄥ崟鍏? 1.void鎸囬拡鏄竴縐嶇壒鍒殑鎸囬拡 void *vp //璇村畠鐗瑰埆鏄洜涓哄畠娌℃湁綾誨瀷 //鎴栬呰榪欎釜綾誨瀷涓嶈兘鍒ゆ柇鍑烘寚鍚戝璞$殑闀垮害 2.浠諱綍鎸囬拡閮藉彲浠ヨ祴鍊肩粰void鎸囬拡 type *p; vp=p; //涓嶉渶杞崲 //鍙幏寰楀彉閲?瀵硅薄鍦板潃鑰屼笉鑾峰緱澶у皬 3.void鎸囬拡璧嬪肩粰鍏朵粬綾誨瀷鐨勬寚閽堟椂閮借榪涜杞崲 type *p=(type*)vp; //杞崲綾誨瀷涔熷氨鏄幏寰楁寚鍚戝彉閲?瀵硅薄澶у皬 杞?http://icoding.spaces.live.com/blog/cns!209684E38D520BA6!130.entry 4.void鎸囬拡涓嶈兘澶嶅紩鐢? *vp//閿欒 鍥犱負(fù)void鎸囬拡鍙煡閬?鎸囧悜鍙橀噺/瀵硅薄鐨勮搗濮嬪湴鍧 鑰屼笉鐭ラ亾鎸囧悜鍙橀噺/瀵硅薄鐨勫ぇ灝?鍗犲嚑涓瓧鑺?鎵浠ユ棤娉曟紜紩鐢? 5.void鎸囬拡涓嶈兘鍙備笌鎸囬拡榪愮畻,闄ら潪榪涜杞崲 (type*)vp++; //vp==vp+sizeof(type) #include<iostream> #include<stdlib.h> #include<string> using namespace std; typedef struct tag_st { char id[10]; float fa[2]; }ST; //鎴戝湪紼嬪簭閲岄潰榪欐牱浣跨敤鐨? int main() { ST * P=(ST *)malloc(sizeof(ST)); strcpy(P->id,"hello!"); P->fa[0]=1.1; P->fa[1]=2.1; ST * Q=(ST *)malloc(sizeof(ST)); strcpy(Q->id,"world!"); Q->fa[0]=3.1; Q->fa[1]=4.1; void ** plink=(void **)P; *((ST *)(plink)) = * Q; //plink瑕佸厛寮哄埗杞崲涓涓?鐩殑鏄負(fù)浜?jiǎn)璁╁畠鍏堢煡閬撹瑕嗙洊鐨勫ぇ灏? //P鐨勫唴瀹圭珶鐒剁粰Q鐨勫唴瀹硅鐩栨帀浜? cout<<P->id<<" "<<P->fa[0]<<" "<<P->fa[1]<<endl; return 0; }
]]> 鏁扮粍褰㈠弬 http://www.shnenglu.com/dragon/archive/2008/09/02/60759.htmlDragon Dragon Tue, 02 Sep 2008 12:15:00 GMT http://www.shnenglu.com/dragon/archive/2008/09/02/60759.html http://www.shnenglu.com/dragon/comments/60759.html http://www.shnenglu.com/dragon/archive/2008/09/02/60759.html#Feedback 0 http://www.shnenglu.com/dragon/comments/commentRss/60759.html http://www.shnenglu.com/dragon/services/trackbacks/60759.html 1錛屾暟緇勫艦鍙傜殑瀹氫箟銆?br>濡傛灉瑕佺紪鍐欎竴涓嚱鏁幫紝杈撳嚭int鍨嬫暟緇勭殑鍐呭錛屽彲浠ョ敤涓嬮潰涓夌鏂瑰紡鎸囧畾鏁扮粍褰㈠弬錛?br>void printValues(int*) void printValues(int[]) void printValues(int[10]) 娉ㄦ剰錛氫笉闇瑕佷慨鏀規(guī)暟緇勫艦鍙傜殑鍏冪礌鏃訛紝鍑芥暟搴旇灝嗗艦鍙傚畾涔変負(fù)鎸囧悜const瀵硅薄鐨勬寚閽?br>void f(const int*) 2,澶氱淮鏁扮粍鐨勪紶閫?br>闄や簡(jiǎn)絎竴緇翠互澶栫殑鎵鏈夌淮鐨勯暱搴﹂兘鏄厓绱犵被鍨嬬殑涓閮ㄥ垎錛屽繀欏繪槑紜寚瀹氾細(xì) void printValues(int (*matrix)[10], int rowSize) void printValues(int matrix[][10], int rowSize)//榪欎釜鏇寸洿瑙? //涓嬮潰鏄緥瀛?br>#include<iostream> using namespace std; //涓緇存暟緇勫艦鍙?br>/* void print(int *a) { cout<<*a<<" "<<*(a+1)<<" "<<*(a+2)<<endl; } */ /* void print(int a[]) { cout<<*a<<" "<<*(a+1)<<" "<<*(a+2)<<endl; } */ /* void print(int a[3]) { cout<<*a<<" "<<*(a+1)<<" "<<*(a+2)<<endl; } */ /* void print(int a[3]) { cout<<a[0]<<" "<<a[1]<<" "<<a[2]<<endl; } */ /* void print(int *a) { cout<<a[0]<<" "<<a[1]<<" "<<a[2]<<endl; } */ /* void print(int a[]) { cout<<a[0]<<" "<<a[1]<<" "<<a[2]<<endl; } */ //涓婇潰鍝竴縐嶉兘琛?br>int main() { int a[3]={2,1,3}; print(a); return 0; } //澶氱淮鏁扮粍浣滃艦鍙?br>#include<iostream> using namespace std; //涓夐変竴 //void print(int (*matrix)[3],int rowsize) //void print(int matrix[2][3],int rowsize) void print(int matrix[][3],int rowsize) { for(int i=0;i<rowsize;i++) { for(int j=0;j<3;j++) { cout<<matrix[i][j]<<" "; } cout<<endl; } } int main() { int a[2][3]= { 1,2,3, 4,5,6 }; print(a,2); return 0; }
]]>
久久久精品国产 |
久久精品国产亚洲AV电影 |
色综合久久中文综合网 |
久久午夜无码鲁丝片 |
亚洲中文字幕无码一久久区 |
少妇被又大又粗又爽毛片久久黑人 |
婷婷综合久久狠狠色99h |
久久AV高清无码 |
国产精品对白刺激久久久 |
99久久精品午夜一区二区 |
国产午夜精品久久久久免费视 |
久久久久99精品成人片试看 |
欧美一区二区三区久久综 |
久久亚洲精精品中文字幕 |
成人综合伊人五月婷久久 |
久久精品国产影库免费看 |
97久久精品人人做人人爽 |
国产精品综合久久第一页
|
99国内精品久久久久久久 |
久久国产成人精品麻豆 |
青青青国产成人久久111网站 |
成人精品一区二区久久 |
久久久久亚洲AV无码专区桃色 |
少妇被又大又粗又爽毛片久久黑人 |
久久中文精品无码中文字幕 |
99久久国产亚洲综合精品 |
亚洲∧v久久久无码精品 |
久久国产精品久久精品国产 |
精品久久久久久久中文字幕 |
伊人久久大香线蕉AV一区二区 |
狠狠色婷婷久久综合频道日韩 |
精品久久久久久无码专区不卡 |
国产午夜福利精品久久 |
麻豆av久久av盛宴av |
国产精品久久久久影视不卡 |
久久人人爽人人爽人人片AV东京热 |
久久人与动人物a级毛片 |
久久福利青草精品资源站 |
手机看片久久高清国产日韩 |
久久久国产乱子伦精品作者 |
久久这里有精品视频 |