gpt4 book ai didi

keyword - "auto," "ansi,"和 "cil managed"在 CIL 中做什么?

转载 作者:行者123 更新时间:2023-12-04 18:03:13 24 4
gpt4 key购买 nike

由于各种原因,我正在学习 CIL,似乎类的定义通常类似于:

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

和函数定义为:
 .method [...] (args) cil managed

我理解其他一切,但我似乎无法找出“自动”或“ansi”或“cil管理”的作用。关键字也太模糊了,我无法获得特定的搜索结果(beforefieldinit 几乎立即出现)。

最佳答案

ECMA-335 提供您寻求的信息,
在 II.10.1 Type header(ClassHeader) 下你会发现:

auto - Layout of fields is provided automatically. - §II.10.1.2

ansi - Marshal strings to platform as ANSI. - §II.10.1.5


Serge Lidin,在他的书中 .Net IL Assembler在第 1 章类声明下写道:

The keyword 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). The keyword ansi defines the mode of string conversion within the class when interoperating with the unmanaged code. This keyword, the default, specifies that the strings will be converted to and from “normal” C-style strings of bytes. Alternative keywords are unicode (strings are converted to and from UTF-16 Unicode) and autochar (the underlying platform determines the mode of string conversion).



在 II.23.1.11 方法标志 [MethodImplAttributes] 下,您可以阅读:

IL - 0x0000 - Method impl is CIL

Managed - 0x0000 - Method impl is managed


Serge Lidin 在第 1 章方法声明下对此进行了描述:

The keywords cil and managed define so-called implementation flags of the MethodDef and indicate that the method body is represented in IL. A method represented in native code rather than in IL would carry the implementation flags native unmanaged.



我建议你买一本关于这个主题的书,我认为有一些。它比在 ECMA-335 规范中挖掘要快得多。

关于keyword - "auto," "ansi,"和 "cil managed"在 CIL 中做什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38910211/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com