ImageVerifierCode 换一换
格式:PDF , 页数:304 ,大小:1.52MB ,
资源ID:704803      下载积分:10000 积分
快捷下载
登录下载
邮箱/手机:
温馨提示:
如需开发票,请勿充值!快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。
如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝扫码支付 微信扫码支付   
注意:如需开发票,请勿充值!
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【http://www.mydoc123.com/d-704803.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(ECMA 372-2005 C++ CLI Language Specification《C++ CLI语言规范 第1版》.pdf)为本站会员(花仙子)主动上传,麦多课文库仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知麦多课文库(发送邮件至master@mydoc123.com或直接QQ联系客服),我们立即给予删除!

ECMA 372-2005 C++ CLI Language Specification《C++ CLI语言规范 第1版》.pdf

1、 ECMA-372 1stEdition / December 2005 C+/CLI Language Specification Standard ECMA-372 1stEdition / December 2005 C+/CLI Language Specification Ecma International Rue du Rhne 114 CH-1204 Geneva T/F: +41 22 849 6000/01 www.ecma-international.org . Table of Contents iii Table of Contents Introduction.xi

2、i 1. Scope. 1 2. Conformance . 2 3. Normative references 3 4. Definitions 4 5. Notational conventions 7 6. Acronyms and abbreviations . 8 7. General description. 9 8. Language overview 10 8.1 Getting started . 10 8.2 Types . 10 8.2.1 Fundamental types and the CLI 12 8.2.2 Conversions 13 8.2.3 CLI ar

3、ray types . 13 8.2.4 Type system unification 13 8.2.5 Pointers, handles, and null 14 8.3 Parameters . 16 8.4 Automatic memory management. 17 8.5 Expressions 18 8.6 Statements 19 8.7 Delegates . 19 8.8 Native and ref classes 20 8.8.1 Literal fields 20 8.8.2 Initonly fields 21 8.8.3 Functions. 21 8.8.

4、4 Properties 21 8.8.5 Events 23 8.8.6 Static operators . 24 8.8.7 Instance constructors. 25 8.8.8 Destructors and finalizers . 25 8.8.9 Static constructors. 26 8.8.10 Inheritance 27 8.9 Value classes . 28 8.10 Interfaces . 28 8.11 Enums 30 8.12 Namespaces and assemblies 30 8.13 Versioning . 31 8.14

5、Attributes . 32 8.15 Generics. 33 8.15.1 Creating and consuming generics . 33 8.15.2 Constraints 34 8.15.3 Generic functions 35 9. Lexical structure 37 9.1 Tokens . 37 9.1.1 Identifiers 37 9.1.2 Keywords 38 C+/CLI Language Specification iv 9.1.3 Literals 39 9.1.4 Operators and punctuators 40 10. Bas

6、ic concepts 41 10.1 Assemblies. 41 10.2 Application entry point 41 10.3 Importing types from assemblies. 41 10.4 Reserved names . 42 10.5 Members 43 10.5.1 Value class members. 43 10.5.2 Delegate members. 43 10.6 Member access 43 10.6.1 Declared accessibility . 43 10.7 Name lookup . 44 11. Preproces

7、sor 48 11.1 Conditional inclusion. 48 11.2 Predefined macro names 48 12. Types 49 12.1 Value types 50 12.1.1 Fundamental types 50 12.2 Class types. 51 12.2.1 Value classes. 51 12.2.2 Ref classes. 51 12.2.3 Interface classes 51 12.2.4 Delegate types. 51 12.3 Declarator types. 52 12.3.1 Raw types 52 1

8、2.3.2 Pointer types . 52 12.3.3 Handle types . 52 12.3.4 Null type . 53 12.3.5 Reference types. 53 12.3.6 Interior pointers. 54 12.3.7 Pinning pointers 55 12.3.8 Native arrays. 57 12.4 Top-level type visibility 57 13. Variables 58 13.1 gc-lvalues. 58 13.1.1 Standard conversions 58 13.1.2 Expressions

9、 . 59 13.1.3 Reference initializers 60 13.1.4 Temporary objects 60 13.2 File-scope and namespace-scope variables . 60 13.3 Direct initialization 60 14. Conversions 62 14.1 Conversion sequences . 62 14.2 Standard conversions. 62 14.2.1 Handle conversions. 62 14.2.2 Pointer conversions. 63 14.2.3 Lval

10、ue conversions . 64 14.2.4 Integral promotions. 64 14.2.5 String literal conversions 65 14.2.6 Boxing conversions. 66 Table of Contents v 14.3 Implicit conversions 66 14.3.1 Implicit constant expression conversions . 66 14.3.2 User-defined implicit conversions 66 14.3.3 Boolean Equivalence 66 14.4 E

11、xplicit conversions 67 14.5 User-defined conversions 67 14.5.1 Constructors 67 14.5.2 Explicit conversion functions . 67 14.5.3 Static conversion functions. 67 14.6 Parameter array conversions 67 14.7 Naming conventions 68 15. Expressions 70 15.1 Function members . 70 15.2 Primary expressions. 71 15

12、.3 Postfix expressions 71 15.3.1 Subscripting and indexed access. 72 15.3.2 Function call . 72 15.3.3 Explicit type conversion (functional notation) 72 15.3.4 Class member access. 73 15.3.5 Increment and decrement 73 15.3.6 Dynamic cast. 73 15.3.7 Type identification 74 15.3.8 Static cast 75 15.3.9

13、Reinterpret cast . 76 15.3.10 Const cast 76 15.3.11 Safe cast 76 15.4 Unary expressions . 77 15.4.1 Unary operators. 77 15.4.2 Increment and decrement 79 15.4.3 Sizeof 80 15.4.4 New. 80 15.4.5 Delete 80 15.4.6 The gcnew operator. 81 15.4.7 The throw expression 81 15.5 Explicit type conversion (cast

14、notation) 81 15.6 Additive operators . 82 15.6.1 Delegate combination . 82 15.6.2 Delegate removal 82 15.6.3 String concatenation 82 15.7 Shift operators . 83 15.8 Relational operators. 83 15.8.1 Handle equality operators . 83 15.8.2 Delegate equality operators. 84 15.8.3 String equality. 85 15.9 Lo

15、gical AND operator. 85 15.10 Logical OR operator 85 15.11 Conditional operator 85 15.12 Assignment operators 85 15.13 Constant expressions . 86 15.14 Property and event rewrite rules 86 16. Statements 89 16.1 Selection statements 89 16.1.1 The switch statement. 89 C+/CLI Language Specification vi 16

16、.2 Iteration statements 89 16.2.1 The for each statement 89 16.3 Jump statements. 91 16.3.1 The break statement 91 16.3.2 The continue statement . 91 16.3.3 The return statement . 91 16.3.4 The goto statement 91 16.4 The try block 91 17. Namespaces 93 17.1 Reserved namespaces 93 18. Functions 94 18.

17、1 -style variable-argument lists. 94 18.2 Name lookup . 94 18.3 Overload resolution . 94 18.4 Parameter arrays 94 18.5 Importing native functions. 96 18.6 Non-member functions 97 18.7 Attributes . 97 19. Classes and members 98 19.1 Class definitions 98 19.1.1 Class modifiers . 99 19.2 Reserved membe

18、r names. 100 19.2.1 Member names reserved for properties. 100 19.2.2 Member names reserved for events 101 19.2.3 Member names reserved for functions 101 19.2.4 Possible collision with reserved property and event names 102 19.3 Data members 103 19.4 Functions . 103 19.4.1 Override functions 104 19.4.

19、2 Sealed function modifier. 107 19.4.3 Abstract function modifier 107 19.4.4 New function modifier 108 19.5 Properties. 109 19.5.1 Qualified names of properties and events. 110 19.5.2 Static and instance properties 111 19.5.3 Accessor functions 111 19.5.4 Virtual, sealed, abstract, and override acce

20、ssor functions 113 19.5.5 Trivial scalar properties 114 19.6 Events 115 19.6.1 Static and instance events . 116 19.6.2 Accessor functions 116 19.6.3 Virtual, sealed, abstract, and override accessor functions 117 19.6.4 Trivial events 117 19.6.5 Event invocation . 117 19.7 Static operators 117 19.7.1

21、 Homogenizing the candidate overload set 119 19.7.2 Operators on handles. 119 19.7.3 Increment and decrement operators 120 19.7.4 Operator synthesis. 123 19.7.5 Naming conventions . 123 19.8 Non-static operators. 126 19.9 Instance constructors . 126 19.10 Static constructors . 127 Table of Contents

22、vii 19.11 Literal fields. 128 19.12 Initonly fields. 129 19.12.1 Using static initonly fields for constants. 130 19.12.2 Versioning of literal fields and static initonly fields. 130 19.13 Destructors and finalizers 130 19.13.1 Destructors 131 19.13.2 Finalizers. 131 20. Native classes . 133 20.1 Fun

23、ctions . 133 20.2 Properties. 133 20.3 Static operators 133 20.4 Delegates . 133 20.5 Friends . 133 20.6 Events 134 20.7 Finalizer. 134 20.8 Initonly and literal fields 134 20.9 Static constructors . 134 21. Ref classes 135 21.1 Ref class definitions 135 21.1.1 Ref class base specification 135 21.2

24、Ref class members. 135 21.2.1 Variable initializers. 135 21.3 Functions . 136 21.4 Properties. 136 21.5 Events 136 21.6 Static operators 137 21.7 Non-static operators. 137 21.8 Instance constructors . 137 21.9 Static constructor. 137 21.10 Literal fields. 137 21.11 Initonly fields. 137 21.12 Destruc

25、tors and finalizers 137 21.13 Delegates . 137 22. Value classes 138 22.1 Value class definitions. 138 22.1.1 Value class base specification. 138 22.2 Value class members . 138 22.3 Ref class and value class differences. 139 22.3.1 Inheritance 139 22.3.2 Default values . 139 22.3.3 Meaning of this .

26、139 22.3.4 Destructors and finalizers . 139 22.4 Simple value classes 140 22.5 Constructors. 140 22.6 Operators . 140 23. Mixed types 141 24. CLI arrays 142 24.1 CLI array types 142 24.1.1 The System:Array type 142 24.2 CLI array creation 143 24.3 CLI array element access. 143 C+/CLI Language Specif

27、ication viii 24.4 CLI array members 144 24.5 CLI array covariance . 144 24.6 CLI array initializers 144 25. Interfaces 146 25.1 Interface definitions. 146 25.1.1 Interface base specification. 146 25.2 Interface members . 146 25.2.1 Functions. 147 25.2.2 Properties 147 25.2.3 Events 147 25.2.4 Delega

28、tes. 148 25.2.5 Member access 148 25.2.6 Destructors and finalizers . 148 25.3 Interface implementations . 148 26. Enums. 150 26.1 Enum definitions . 150 26.1.1 Enum base specification . 151 26.1.2 Initial enumerator values. 151 26.1.3 CLI enum values and operations. 151 26.2 The System:Flags attrib

29、ute. 151 27. Delegates. 153 27.1 Delegate definitions. 153 27.2 Delegate instantiation 155 27.3 Delegate invocation . 156 28. Exceptions and exception handling . 157 28.1 Common exception classes 157 28.2 Exception specifications 158 29. Attributes . 159 29.1 Attribute classes. 159 29.1.1 Attribute

30、usage 159 29.1.2 Positional and named parameters 160 29.1.3 Attribute parameter types 161 29.2 Attribute specification . 161 29.3 Attribute instances . 165 29.3.1 Compilation of an attribute . 165 29.3.2 Run-time retrieval of an attribute instance 166 29.4 Reserved attributes 166 29.4.1 The Attribut

31、eUsage attribute. 166 29.4.2 The Obsolete attribute. 166 29.4.3 The Conditional attribute 167 29.4.4 Security attributes . 167 29.5 Attributes for interoperation 167 29.5.1 Interoperation with other CLI-based languages 167 29.5.2 Interoperation with native code 167 30. Templates. 168 30.1 Template d

32、eclarations 168 30.2 Template specialization . 168 30.3 Attributes . 168 30.4 Type deduction 169 30.4.1 Template argument deduction. 169 Table of Contents ix 31. Generics 170 31.1 Generic declarations 170 31.1.1 Type parameters 171 31.1.2 Referencing a generic type by name. 172 31.1.3 The instance t

33、ype 172 31.1.4 Base classes and interfaces . 173 31.1.5 Class members 173 31.1.6 Static members 174 31.1.7 Operators. 175 31.1.8 Member overloading. 175 31.1.9 Member overriding . 176 31.1.10 Nested types 176 31.2 Constructed types 177 31.2.1 Open and closed constructed types . 178 31.2.2 Type argum

34、ents. 178 31.2.3 Base classes and interfaces . 179 31.2.4 Class members 179 31.2.5 Accessibility 180 31.3 Generic functions. 180 31.3.1 Function signature matching rules 181 31.3.2 Type deduction . 182 31.4 Constraints. 184 31.4.1 Satisfying constraints 185 31.4.2 Member lookup on type parameters 18

35、7 31.4.3 Type parameters and boxing. 188 31.4.4 Conversions involving type parameters 189 32. Standard C and C+ libraries 190 33. CLI libraries 191 33.1 Custom modifiers 191 33.1.1 Signature matching . 191 33.1.2 modreq vs. modopt 192 33.1.3 Modifier syntax. 192 33.1.4 Types having multiple custom m

36、odifiers 193 33.1.5 Standard custom modifiers . 194 33.2 Standard attributes . 199 33.2.1 NativeCppClass 199 34. Metadata 200 34.1 Basic concepts . 200 34.1.1 Importing types from assemblies 200 34.2 Types . 200 34.2.1 Reference types. 200 34.2.2 Interior pointers. 201 34.2.3 Pinning pointers 201 34

37、.2.4 Native arrays. 202 34.3 Variables 202 34.3.1 File-scope and namespace-scope variables. 202 34.4 Conversions . 202 34.4.1 String literal conversions 202 34.4.2 Boxing conversions. 202 34.4.3 Conversion functions 203 34.5 Expressions 203 34.5.1 Class member access. 203 C+/CLI Language Specificati

38、on x 34.5.2 Dynamic cast. 204 34.5.3 Safe cast 204 34.6 Functions . 204 34.6.1 Name lookup. 204 34.6.2 Parameter arrays 204 34.6.3 Importing native functions 205 34.6.4 Non-member functions . 206 34.7 Classes and members. 206 34.7.1 Class definitions 206 34.7.2 Member access 208 34.7.3 Data members

39、. 209 34.7.4 Functions. 210 34.7.5 Properties 213 34.7.6 Events 215 34.7.7 Static operators . 217 34.7.8 Non-static operators 218 34.7.9 Instance constructors. 219 34.7.10 Static constructors. 220 34.7.11 Literal fields 220 34.7.12 Initonly fields 220 34.7.13 Destructors and finalizers . 221 34.8 Na

40、tive classes 228 34.9 Ref classes . 230 34.10 Value classes . 230 34.11 CLI arrays 231 34.12 Interfaces . 232 34.13 Enums 233 34.14 Delegates . 234 34.15 Exceptions . 235 34.16 Attributes . 236 34.17 Templates 239 34.18 Generics. 239 Annex A. Grammar 240 A.1 Keywords 240 A.2 Lexical conventions 240

41、A.3 Basic concepts 243 A.4 Expressions. 244 A.5 Statements. 247 A.6 Declarations 248 A.7 Declarators 250 A.8 Classes 252 A.9 Properties and events 253 A.10 Derived classes . 254 A.11 Special member functions. 254 A.12 Overloading 255 A.13 Delegates 255 A.14 Templates 255 A.15 Generics 256 A.16 Excep

42、tion handling . 257 A.17 Attributes 257 A.18 Preprocessing directives . 258 Annex B. Verifiable code 260 Annex C. Documentation comments . 261 Table of Contents xi C.1 Introduction. 261 C.2 Recommended tags . 262 C.2.1 . 262 C.2.2 263 C.2.3 263 C.2.4 263 C.2.5 264 C.2.6 265 C.2.7 . 265 C.2.8 . 265 C

43、.2.9 266 C.2.10 266 C.2.11 267 C.2.12 267 C.2.13 267 C.2.14 268 C.2.15 268 C.2.16 269 C.2.17 . 269 C.3 Processing the documentation file 269 C.3.1 ID string format 269 C.3.2 ID string examples . 270 C.4 An example. 273 C.4.1 C+ source code. 273 C.4.2 Resulting XML. 276 Annex D. Non-normative referen

44、ces . 279 Annex E. CLI naming guidelines. 280 Annex F. Future directions. 281 F.1 Expressions 281 F.1.1 Class member access 281 F.1.2 Type identification 281 F.1.3 Pointer type portability . 281 F.2 Statements . 281 F.2.1 The checked and unchecked statements . 281 F.3 Classes. 281 F.3.1 Delegating c

45、onstructors 281 F.3.2 Properties 283 F.3.3 Events . 283 F.3.4 Unsupported CLS-recommended operators 283 F.3.5 Operators true and false 284 F.4 Generic types. 284 F.5 Custom modifiers 284 F.5.1 IsPinned 284 F.6 Attributes. 284 Annex G. Portability issues 285 G.1 Undefined behavior 285 G.2 Implementat

46、ion-defined behavior. 285 G.3 Unspecified behavior 285 Annex H. Index 286 C+/CLI Language Specification xii Introduction This Standard is based on a submission from Microsoft. It describes a technology, called C+/CLI, which is a binding between the Standard C+ programming language and the Common Lan

47、guage Infrastructure (CLI). That submission evolved from another Microsoft project, Managed Extensions for C+, the first widely distributed implementation of which was released by Microsoft in July 2000, as part of its .NET Framework initiative. The first widely distributed beta implementation of C+

48、/CLI was released by Microsoft in July 2004. Ecma Technical Committee 39 (TC39) Task Group 5 (TG5) was formed in October 2003, to produce a standard for C+/CLI. (Another Task Group, TG3, was formed in September 2000 to produce a standard for a library and execution environment called Common Language

49、 Infrastructure. The current version of that standard is ECMA-335, 3rd edition, June 2005. CLI is based on a subset of the .NET Framework.) The goals used in the design of C+/CLI were as follows: Provide an elegant and uniform syntax and semantics that give a natural feel for C+ programmers. Provide first-class support for CLI features (e.g., properties, events, garbage collection, and generics) for all types including existing Standard C+ classes. Provide first-class support for Standard C+ features (e.g., deterministic destruction, templates) for all typ

copyright@ 2008-2019 麦多课文库(www.mydoc123.com)网站版权所有
备案/许可证编号:苏ICP备17064731号-1