首页 新闻 赞助 找找看

IL中的.auto问题

0
悬赏园豆:5 [已解决问题] 解决于 2009-06-10 20:19

大家好!最近在看一些关于.NET平台的IL的技术文章。其中说到.auto指令,源码如下:

.class public auto ansi beforefieldinit HelloWorld extends [mscorlib] System.Object

其中对auto的解释是:程序加载时的内存布局由CLR决定。

这个内存布局到底是什么意思?望各位给小弟一个详细的说明。期待中~~~

雪燃的主页 雪燃 | 初学一级 | 园豆:149
提问于:2009-05-10 20:39
< >
分享
最佳答案
1

我不知道楼主是说的内存布局这个名词的出处在哪里,我觉得可能是翻译的问题,英文原词应该是 layout style.

Expert.Net 2.0 IL assembler 这本书上的英文原文是这样的。

The keywords public.auto in this context defines the class layout style (automatic,the default), directing the loader to lay out this class however it sees fit. Alternatives are sequential (which preserves the specified sequence of the fields) and explicit (which explicitly specifies the offset for each field, giving the loader exact instructions for laying out the class).

这段英文比较绕人,我尝试翻译一下,翻译的不好,仅供参考。

在这个上下文中关键字public.auto 定义了类的布局风格(自动,默认),从而指示加载器按它觉得合适的方式来布局这个类。两种布局方式分别是顺序方式(按照字段清单的顺序布局) 和 明确方式(明确指定每个字段的偏移,提供加载器精确的指令布局这个类)。

 

 

eaglet | 专家六级 |园豆:17139 | 2009-05-11 08:43
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册