青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品

asm, c, c++ are my all
-- Core In Computer
posts - 139,  comments - 123,  trackbacks - 0

/********************************************\
|????歡迎轉(zhuǎn)載, 但請保留作者姓名和原文鏈接, 祝您進(jìn)步并共勉!???? |
\********************************************/


1.2 A Keyword Distinction

作者: Jerry Cat
時(shí)間: 2006/04/20
鏈接: http://www.shnenglu.com/jerysun0818/archive/2006/04/22/6064.html

-------------------------
unequivocal: 毫不含糊的
pedestrian:? 步行者; 步行的, 呆板的, 通俗的
infamous:??? 聲名狼藉的
strike aside:閃躲開
brandish:??? 揮舞(n. & v.)
fledgling:?? n.羽毛初長的雛鳥, 羽翼未豐無經(jīng)驗(yàn)的人, 初出茅廬的人
underpinning:基礎(chǔ), 支柱, 支撐
discourse:?? 談話, 演說, 演講, 論文(n. & v.)

C++的struct 與 class有惱人的曖昧關(guān)系, 表面上struct里沒顯式說明存儲權(quán)限的全是public而class則全是private, 事實(shí)卻并非如此簡單當(dāng)考慮到與C的兼容時(shí), 尤其是對待C中的tricks時(shí), 更是traps多多, 地雷密布!

A C program's trick is sometimes a C++ program's trap. One example of this is the use of a one-element array at the end of a struct to allow individual struct objects to address variable-sized arrays:

struct mumble {
?? /* stuff */
?? char pc[ 1 ];
};

// grab a string from file or standard input
// allocate memory both for struct & string

struct mumble *pmumb1 = ( struct mumble* )
?? malloc(sizeof(struct mumble)+strlen(string)+1);//在C中內(nèi)存連續(xù)分布的, 但若考慮到
?? //這是在C++中, struct基本上就是類, 這類的數(shù)據(jù)成員與外來(參)變量的"tricky 捆綁式"
?? //內(nèi)存布局將導(dǎo)致派生類的數(shù)據(jù)成員"插不進(jìn)去"從而導(dǎo)致類的數(shù)據(jù)成員內(nèi)存布局不連續(xù)!
?? //所以C的trick是非標(biāo)準(zhǔn)的不能濫用!

strcpy( &mumble.pc, string );
This may or may not translate well when placed within a class declaration that

1). specifies multiple access sections containing data,
2). derives from another class or is itself the object of derivation, or
3). defines one or more virtual functions.

The data members within a single access section are guaranteed within C++ to be laid out in the order of their declaration. The layout of data contained in multiple access sections, however, is left undefined. In the following declaration, for example, the C trick may or may not work, depending on whether the protected data members are placed before or after those declared private:

class stumble {
public:
?? // operations ...
protected:
?? // protected stuff
private:
?? /* private stuff */
?? char pc[ 1 ];
};
?
Similarly, the layout of data members of the base and derived classes is left undefined, thereby also negating any guarantee that the trick might work. The presence of a virtual function also places the trick's viability in question. The best advice is not to do it. (Chapter 3 discusses these layout issues in greater detail.)

//接上
If a programmer absolutely needs a data portion of an arbitrarily complex C++ class to have the look and feel of an equivalent C declaration, that portion is best factored out into an independent struct declaration. The original idiom for combining this C portion with its C++ part (see [KOENIG93]) was to derive the C++ part from the C struct:

struct C_point { ... };
class Point : public C_point { ... };
thus supporting both the C and C++ usage:

extern void draw_line( Point, Point );
extern "C" void draw_rect ( C_point, C_Point );

draw_line( Point( 0, 0 ), Point( 100, 100 ));
draw_rect( Point( 0, 0 ), Point( 100, 100 ));
This idiom is no longer recommended, however, because of changes to the class inheritance layout in some compilers (for example, the Microsoft C++ compiler) in support of the virtual function mechanism (see Section 3.4 for a discussion). Composition, rather than inheritance, is the only portable method of combining C and C++ portions of a class (the conversion operator provides a handy extraction method):

struct C_point { ... };

class Point {
public:
?? operator C_point() { return _c_point; }
?? // ...
private:
?? C_point _c_point;
?? // ...
};

強(qiáng)烈不推薦這種種"淫巧",? 不過在C/C++混合編程時(shí)你還不得不用它:)
One reasonable use of the C struct in C++, then, is when you want to pass all or part of a complex class object to a C function. This struct declaration serves to encapsulate that data and guarantees a compatible C storage layout. This guarantee, however, is maintained only under composition. Under inheritance, the compiler decides whether additional data members are inserted within the base struct subobject (again, see Section 3.4 for a discussion, as well as Figures 3.2(a) and 3.2(b)).

posted on 2006-04-22 01:23 Jerry Cat 閱讀(670) 評論(0)  編輯 收藏 引用

只有注冊用戶登錄后才能發(fā)表評論。
網(wǎng)站導(dǎo)航: 博客園   IT新聞   BlogJava   博問   Chat2DB   管理



<2006年4月>
2627282930311
2345678
9101112131415
16171819202122
23242526272829
30123456

常用鏈接

留言簿(7)

隨筆檔案

最新隨筆

搜索

  •  

最新評論

閱讀排行榜

評論排行榜

青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            国产午夜精品一区二区三区欧美| 韩国三级电影久久久久久| 在线观看亚洲一区| 免费久久精品视频| 久久在线免费| 亚洲精品午夜| 亚洲毛片一区二区| 国产精品高精视频免费| 午夜日韩av| 欧美在线3区| 在线成人激情视频| 最新成人av网站| 欧美日韩高清在线观看| 亚洲影视中文字幕| 欧美在线播放一区二区| 在线看国产一区| 亚洲精品中文字幕女同| 国产精品福利在线| 久久国产视频网站| 免播放器亚洲一区| 亚洲无限乱码一二三四麻| 亚洲调教视频在线观看| 一区二区亚洲欧洲国产日韩| 亚洲黄色在线看| 国产精品一区二区三区久久| 免费久久99精品国产| 欧美三日本三级少妇三2023 | 久久影院午夜论| 日韩视频不卡中文| 亚洲欧美日韩一区二区三区在线观看| 狠狠88综合久久久久综合网| 最新中文字幕亚洲| 国产视频精品xxxx| 亚洲久色影视| 在线不卡a资源高清| 一区二区三区欧美日韩| 激情综合色综合久久综合| 亚洲另类在线视频| 韩日成人av| 亚洲免费一级电影| 亚洲精品一区二区三区av| 欧美亚洲综合另类| 亚洲一二三区在线| 免费高清在线视频一区·| 午夜精品一区二区三区四区| 欧美成人一品| 免费成人高清在线视频| 国产欧美日韩另类视频免费观看| 亚洲国产精品成人| 国内视频一区| 亚洲综合日韩| 亚洲综合99| 欧美日韩三级视频| 亚洲精品久久久久久久久| 在线视频成人| 久久精品国产91精品亚洲| 午夜亚洲福利| 欧美三级午夜理伦三级中视频| 欧美成人一区在线| 极品日韩久久| 久久成人国产| 久久全球大尺度高清视频| 国产精品午夜av在线| 一区二区不卡在线视频 午夜欧美不卡在 | 欧美国产高清| 亚洲第一福利在线观看| 欧美制服第一页| 久久九九热免费视频| 国产欧美一区二区精品性色| 亚洲资源在线观看| 欧美影院一区| 国精品一区二区| 欧美伊人久久久久久午夜久久久久| 欧美一区二区三区电影在线观看| 国产精品成人一区二区三区夜夜夜| 亚洲精品综合精品自拍| 亚洲一二区在线| 国产精品入口日韩视频大尺度| 亚洲先锋成人| 久久精品观看| 在线观看成人一级片| 葵司免费一区二区三区四区五区| 欧美激情精品久久久久久大尺度| 亚洲欧洲日韩在线| 欧美日韩国产免费| 亚洲一区影音先锋| 久久精品综合网| 亚洲欧洲一区| 欧美亚州一区二区三区| 亚洲综合丁香| 欧美mv日韩mv国产网站| 夜夜嗨av一区二区三区四区| 欧美日韩精品系列| 亚洲欧美中日韩| 欧美va天堂在线| 亚洲无吗在线| 黄色资源网久久资源365| 另类尿喷潮videofree| 亚洲美女精品久久| 久久精品国产视频| 亚洲三级网站| 国产日韩一区欧美| 欧美aaa级| 亚洲欧美清纯在线制服| 亚洲二区在线观看| 欧美一级视频精品观看| 亚洲国产一区二区三区a毛片| 欧美日韩中国免费专区在线看| 香蕉av777xxx色综合一区| 亚洲国产成人av| 欧美一区二区网站| 日韩视频免费观看高清在线视频| 国产精品中文字幕在线观看| 免费看成人av| 欧美一区二区视频97| 亚洲精品一区在线| 久久综合亚洲社区| 亚洲一区在线直播| 亚洲激情欧美激情| 国产区亚洲区欧美区| 欧美日韩人人澡狠狠躁视频| 久久中文在线| 欧美一级大片在线观看| av成人免费观看| 亚洲大片一区二区三区| 亚洲女女女同性video| 国产精品视频一| 欧美jizzhd精品欧美巨大免费| 亚洲欧美另类综合偷拍| 最新日韩av| 欧美国产一区二区在线观看| 久久久久国产成人精品亚洲午夜| 在线视频欧美精品| 亚洲精品日韩在线观看| 在线观看欧美激情| 国产一区二区三区四区hd| 国产精品爱久久久久久久| 蜜桃av综合| 美女视频黄 久久| 久久精品国产99国产精品澳门| 亚洲综合电影一区二区三区| 一区二区成人精品| 日韩一区二区精品葵司在线| 亚洲日本中文字幕| 亚洲激情精品| 亚洲国产一区二区在线| 亚洲成色777777在线观看影院| 美脚丝袜一区二区三区在线观看| 久久成人综合网| 久久青草福利网站| 久久午夜av| 免费短视频成人日韩| 模特精品裸拍一区| 欧美高清视频在线播放| 欧美国产日韩一区二区三区| 欧美高清在线视频| 亚洲韩国精品一区| 亚洲精品三级| 国产精品99久久久久久人| 一区二区三区视频在线看| 亚洲免费视频网站| 久久国产精品99国产精| 久久久欧美精品| 欧美国产三区| 国产精品久久国产精麻豆99网站| 国产精品麻豆欧美日韩ww | 亚洲在线一区| 亚洲欧美色婷婷| 久久精品国产精品亚洲综合| 久久久国产91| 欧美精品成人一区二区在线观看| 欧美日韩1080p| 国产日韩精品综合网站| 韩国av一区二区三区在线观看| 亚洲第一在线| 亚洲一区二区三区欧美| 久久久精品国产免大香伊 | 久久精品夜色噜噜亚洲aⅴ| 老鸭窝91久久精品色噜噜导演| 欧美黄污视频| 亚洲永久在线| 免费精品视频| 国产精品久久久久久久9999| 伊人男人综合视频网| 亚洲视频在线播放| 久久免费高清| 亚洲视频在线观看视频| 久久久天天操| 国产精品一级久久久| 亚洲国产导航| 亚欧成人在线| 亚洲经典在线| 久久久www成人免费无遮挡大片 | 麻豆亚洲精品| 国产美女在线精品免费观看| 亚洲国产欧美在线| 性视频1819p久久| 亚洲区国产区| 久久全国免费视频| 国产日韩在线看片|