C++/CLI Standard.pdf

所需积分/C币:15 2007-02-27 14:34:51 902KB PDF
收藏 收藏
举报

This International Standard is based on a submission from Microsoft. It describes a technology, called C++/CLI, that is a binding between the Standard C++ programming language and the ECMA and ISO/IEC Common Language Infrastructure (CLI) (§3). That submission was based on another Microsoft project
Table of contents Table of contents Introduction ommmommmomm xi I Scop 1 2. Conformance 命命命春·自合春自自··自白命 2 3. Normative references 4. Definitions……, 5. Notational conventions 6. Acronyms and abbreviations 鲁看DD鲁 4789 7. General description 鲁音音音音·香着··鲁音非非音。音,音非自。。非音音自音音。非音 8. Language overview mmmmmmmmmomommmmmmmommom 10 8. I Getting started 10 8.2 Types........,. 10 8.2. 1 Fundamental types and the cli 12 8.2.2 Conversions 8.2.3 Array types..........…… 8.2.4 Type system unification 13 8.2.5 Pointers, handles, and null..…………14 8. 3 Parameters 5 8. 4 Automatic memory management 17 8.5 Expressions ·。,·· 18 8.6 Statements 18 8.7 Delegates… 18 8. 8 Native and ref classes …19 8. 8. 1 Literal fields ““+ 19 8.8.2 Initonly fields 20 8.8. 3 Functions 20 8.8.4 Properties 8. 5 Events 23 8.8.6 Static operators 24 8. 8.7 Instance constructors 8. 8.8 Destructors 5 8. 8. 9 Static constructors ,垂 25 8.8.10 Inheritance ·, 单章 8.8.10. 1 Function overriding 5 8.9 Value classes 27 8.10 Interfaces ∴27 8.11 Nun ·········;·;::4····· 8. 12 Namespaces and assemblies 29 8.13 Versioning…. …30 8. 14 Attributes 8.15 Generics 32 8.15. 1 Creating and consuming generics 8. 15.2 Constraints 33 8.153 Generic functions…………… 134 9. Lexical structure 自pD鲁。春。非非非香自。。。。DD鲁鲁音春。看看电。非自春自DD鲁鲁。非春非自自。。。。DD鲁。非鲁 b春鲁非非音音 36 9.1 Tokens 36 9.1.1 Identifiers 36 C++/CLI Language Specification 9.1.2 Kevwords 7 9.1.3 Literals 7 9. 13.1 The null literal 38 9.1.4 Operators and punctuators 38 10. Basic concepts...a.... 39 10.⊥ Members 39 10.1.1 Value class members 39 10.1.2 Delegate members .39 10.2 Member access 10.2. 1 Declared accessibility ll Preprocessor 41 Il. I Predefined macro names . 12. Types…...........42 12.l上 undamental types....,.,.,.,,,….,.………….42 12.2 Class types ……143 12.2.1 Native classes 43 12.2.2 Value classes …43 12. 2.2.1 Simple value classes 12.2.2. 2 Enum classes 12. 2. 3 Ref classes 43 12.2. 4 Interface classes ++·+“++ 2.2.5 Delegate types……… 12.2.6 Arrays 43 12.3 Declarator types 43 2.3.1 Raw types......,.….…,….,.……… 12.3.2 Pointer types 12.3.3 Handle types 12.3. 4 Null type 12.3.5 Reference types 444 12.3.6 Interior pointers... 45 12.36.1 Definitions 12.3.6.2 Target type restrictions 45 12.3.6.3 Operations…… …45 123.6. 4 Conversion rules 12. 3.6.5 Data access 46 12.3.6.6 The this pointer…… 47 12.3.7 Pinning pointers…… 47 12.3.7.I Definitions 47 12.3.7.2 Target type restrictions 47 12.3.7.3 Operations 12.3. 7.4 Conversion rules 12.3. 7.5 Data access 48 12.3.7.6 Duration of pinning 48 12.4 Top-level type visibility 49 13. Variables 14. Conversions 151 14.1 Standard conversions 1 41. Handle conversions 14.1.2 Pointer conⅤ ersIons… 51 14.1.3 Lvalue conversions 14.2 Implicit conversions Table of contents 14.2. 1 Implicit constant expression conversions 14.2.2 User-defined implicit conversions ,·····垂,4 52 14.3 Explicit conversions 52 14. 4 Boxing conversions 14.5 User-defined conversions 14.5.1 Constructors 53 14.5.2 Explicit conversion functions....,.,.,.,.,,…,….………53 14.5. 3 Static conversion functions 14.6 Parameter array conversions 14.7 Compiler-defined explicit conversions 14.7.1 Unboxing conversions……… 4 14.8 Naming conventions…………,…,…,…,…,…,…,…,…,…,…,…,…,…,…,…,,…,…,…,…,…,…………54 14.8.1 CLS-compliant conversion functions .......55 14.8.2 C++-dependent conversion functions 5 15. Expressions…,,,. 15.1 Function members .56 15.2 Primary expressions 56 15.3 Postfix expressions 56 153. 1 Subscripting 57 15.3.2 Indexed access 57 15. 3.3 Function call 7 15.3. 4 Explicit type conversion(functional notation) 58 15.3. 5 Pseudo destructor call 58 15.3. 6 Class member access 58 15.3.7 Increment and decrement 58 15.3. 8 Dynamic cast 58 15.3.9 Type identification 15.3.10 Static cast 15.3. 11 Reinterpret cast 6 15.3. 12 Const cast 15.3.13 Safe cast 6 15. 4 Unary expressions 61 15.4. Unary operators 15.4.1.1 Unary&.. 154.1.2 Unary*…… 15.4.1.3 Unary% 62 154.1.4 Unary^…….6 15.4.2 Increment and decrement 15.4. 3 Sizeof …62 1544New. 15.4.5 Delete 15.4.6 The gcnew operator. 15.4.6.1 gcnew Object creation expressions 15.4.6.2 Array creation expressions.. 15.5 Explicit type conversion(cast notation) ·; 15.6 Pointer-to-member operators 15.7 Multiplicative operators 15.8 Additive operators 5.8.1 Delegate combination 15.8.2 Delegate removal 15.9 Shift operators 15.10 Relational operators ∴65 15.11 Equality operators ··,垂垂 65 15.11. 1 Ref class equality operators C++/CLI Language Specification 15.11.2 Delegate equality operators ·· .65 15.12 Bitwise AND operator ….65 5. 13 Bitwise exclusive OR operator 65 15. 14 Bitwise inclusive OR operator.. 5.15 Logical aNd operator 65 5.16 Logical or operator 65 15 17 Conditional operator... 65 15.18 Assignment operators 15.19 Comma operator…… 1520 Constant expressions…… 16. Statements 67 16.1 Selection statements 67 16.1. 1 The switch statement 16.2 Iteration statements 67 16.2.I The for each statement 67 16.3 Jump statements 68 16.3.1 The break statement 68 16.3.2 The continue statement 68 16.3. 3 The return statement 16.3. 4 The goto statement ∴69 16. 3. 5 The throw statement 16. 4 The try statement... 17. Namespaces 春非非非垂鲁·a。。·DD鲁。非。非。垂看非。自pD。非。非。垂看看自。。非春自D鲁。。非非。音。看。。音·D鲁鲁非音。非非。看看看。鲁春D鲁鲁非非非看自。鲁自D鲁。。非非 18. Classes and members 18.1 Class definitions 18. 1. 1 Class modifiers 73 18.1. 1.1 Abstract classes 18.1.1. 2 Sealed classes 18.2 Reserved member names…… .74 18.2.1 Member names reserved for properties.…………,………… 74 18.2.2 Member names reserved for events ..........................................................................................75 18.2. 3 Member names reserved for functions 75 18.3 Functions… 75 18. 3. 1 Override functions 76 18.3.2 Sealed function modifier 78 18.3.3 Abstract function modifier 18.34 New function modifier 183.5上 unction overloading… 18.3. 6 Parameter arrays 18.4 Propertie 82 18.4. I Static and instance properties 18. 4.2 Accessor functions 18.4. 3 Virtual. sealed. abstract and override accessor functions 86 18.4.4 Trivial scalar properties....,.,…,…,…,…,…,…………88 18.5 Events 18.5.1 Static and instance events 18.5.2 Accessor functions 8.5.3 Virtual. sealed. abstract. and override accessor functions 90 18.5 4 Trivial events 18.5.5 Event invocation 18.6 Static operators ,+44· 18.6. 1 Homogenizing the candidate overload set 18.6.2 Operators on Handles 93 Table of contents 18.6.3 Increment and decrement operators 18.6.4O perator synthesIs……… 18.6.5 Naming conventions 96 18.6.5.1 CLS-compliant operators...,...., 96 18.6.5. 2 Non-C++ operators. 18.6.5.3 Assignment operators .98 18.6.5.4 C++-dependent operators ·“····*··;;······· 98 18.6.6 Compiler-defined operators 18.6.6.I equality 100 18.7 Instance constructors ······ …100 18. 8 Static constructors 100 18.9 Literal fields ··“····;·++44··‘···· 10l 18.10 Initonly fields ·· 8. 10. 1 Using static initonly fields for constants 103 18.10.2 Versioning of literal fields and static initonly fields………………………,……103 18. 11 Destructors and finalizers 19. Native classes 105 19.1 Functions 105 19.2 Properties 105 19.3 Static operators ···。,垂垂 105 19.4 Instance constructors 105 19.5 Delegates 105 20. Ref classes omm....msmmmmommmommm 106 20.1 Ref class declarations 20.1.1 Ref class base specification……………… ··面 106 20. 2 Ref class members 106 20.2.1 Variable initializers 20.3F 107 20.4 Properties… 108 20.5 Events 108 20.6 Static operators... ·4····;·++:444·4··4····;· 108 20.7 Instance constructors 108 20. 8 Static constructor 108 20.9 Literal fields 108 20.10 Initonly fields .108 20.11 Destructors and finalizers 108 20.12 Delegates 108 21. Value classes∴ 109 21.1 Value class declarations 109 21.1.1 Value class modifiers 109 21. 1. 2 Value class base specification.. 109 21.2√ alue class members… 110 21. 3 Ref class and value class differences 10 21.4 Simple value classe....,.,,.,.,.,.,……,…………………,10 21.4.1 Constructors 110 22. Mixed classes DD。垂鲁。·看看。 111 23. Arrays.…....12 23. 1 Array types l12 23. 1. 1 The System::: Array type.... 112 23.2 Array creation 12 23. 3 Array element access 113 C++/CLI Language Specification 23 4 Array members 113 23. 5 Array covariance 113 23. 6 Array initializers 113 24. Interfaces 114 24.1 Interface declarations 114 24.I. I Interface base specification.... l14 24.2 Interface members 114 242.1 Interface functions 115 24.2. 2 Interface properties... ……115 242.3 Interface events 115 24.2. 4 Delegates 116 24.2.5 Interface member access 116 24.3 Fully qualified interface member names……… 116 24.4 Interface implementations 6 25. Enums 117 25.1 Native enums 117 25.1.1 Native enum declarations 17 25. 1.2 Native enum visibility. 117 251.3 Native enum underlying type…… .···:······“ 117 251. 4 Native enum members 118 25.2 CLI enums 118 25.2.1 CLI enum declarations l18 25.2. 2 CLI enum visibility 118 25.2.3 CLI enum underlying type 118 25. 2. 4 CLI enum members 118 25. 2.5 CLi enum values and operations 118 253 The system: Enum type…… 119 26. Delegates.m.m.ees 120 26.1 Delegate definitions …120 26.2 Delegate instantiation 122 26.3 Delegate invocation 22 27. Exceptions…...,.….…….,….………….,……………124 27.1 Common exception classes 124 28. Attributes 125 28.1 Attribute classes 125 28.1.1 Attribute usage...,.,.,...,.,125 28.1.2 Positional and named parameters 126 28.1. 3 Attribute parameter types.... .·“丰· ·++·‘····· 127 28.2 Attribute specification ·+· 127 28.3 Attribute instances 130 28.3. 1 Compilation of an attribute 28.3.2 Run-time retrieval of an attribute instance .131 28 4 Reserved attributes 13 284.1 The attribute Usage attribute.....,.,……………,13 28. 4.2 The obsolete attribute 13 28.5 Attributes for interoperation 132 28.5. 1 Interoperation with other CLI-based languages 132 28.5.1.I The DefaultMember attribute 132 28.5.1. 2 The MethodImplOption attribute ·*:::······*:::::·· 29. Templates….,.,.,… 133 Table of contents 29.1 Attrib 29.2 Type deduction…… ……133 30.G 134 30.1 Generic declarations 134 30.1.1T 135 30.1. 2 Referencing a generic type by name 135 30.1.3 The instance type………… 136 30.1.4Ba interfa 36 30.1.5 Class members 137 30.1.6 Static memb 138 30.1.7Or 139 30.1.8Memb 139 30.19 Member overriding…… 140 30.1.10 Nested types.... .140 30.2 Constructed ty pes………… .141 30.2. 1 Open and closed constructed types 14 30.2.2 Type arguments....,.,…,…,…….,…,…,……………………,142 30.2.3 Base classes and interfaces 30.2 4 Class members 143 30.2.5 Accessibility.… 1,····。。·,,面非。·, 144 30.3 Generic functions 144 30.3. 1 Function signature matching rules 145 30.3.2 Type deduction…… 146 30. 4 Constraints 148 30.4.I Satisfying constraints l49 30.4.2 Member lookup on type parameters..... 149 30. 4.3 Type parameters and boxing.. 150 30.4. 4 Conversions involving type parameters .,…………150 31. Standard c and c++ libraries. mmmommmmmmmmmm, 151 32. CLI libraries. 32.1 Custom modifiers. 32.1. 1 Signature matching 152 32. 1.2 modred vS. modopt ……153 32. 1.3 Modifier syntax 153 32. 1. 4 Types having multiple custom modifiers l54 32.1.5 Standard custom modifiers ......................................................................................................155 32.1.5.1 Is Boxed… 155 32.1.5. 2 Is By value l56 32. 1.5 3 Is Const 156 32 1.5.4 Is Explicitly Dereferenced 156 32.1. 5.5 IsImplicitly Dereferenced 156 321.56 IsLong……… …157 32. 1.5.7 SPInned 158 32.1.5.8 IsSignUnspecifiedByte………,…,…,,..…,l8 32.1.59 IsUdtreturn 32.1.5.10 Is Volatile …159 Annex A verifiable code mmmmmmmommomm 161 Annex B. documentation comments 162 Annex C. Non-normative references 163 Annex D. cli naming guidelines …164 C++/CLI Language Specification D I Capitalization styles D 1. I Pascal casing........ D.1.2 Camel casing…… D.1.3 All uppercase…....,…, D 1. 4 Capitalization summary 164 D 2 Word choice 165 D.3 Namespaces… 16 D. 4 Classes 165 D5 Interfaces 166 D.6 Enums… 166 D 7 Static members 167 D 8 Parameters 167 D 9 Functions 167 D10 Properties +·· 167 D.11 Events ……………………168 D.12 Case sensitivity 168 D 13 Avoiding type name confusion.... …169 Annex E. Future E 1 Static members in interfaces 170 上.2 Mixed types………,, 170 E.3 of unmanaged types 170 E 4 new of managed types 170 E5 Unsupported CLS-recommended operators... 170 E 6 Literals 170 E 7 Delegating constructors 170 E. 8 The checked and unchecked statements 73 Annex f. Incompatibilities with Standard o++….,……… 174 Annex G. index D鲁鲁非非·。a。。DD鲁。非非垂 看·。。鲁。。着自自。。。。。DD鲁。。·。。。鲁。。非音。音非非看看·。鲁。。音鲁鲁非音非自。。鲁鲁D 175

...展开详情
试读 127P C++/CLI Standard.pdf
立即下载 低至0.43元/次 身份认证VIP会员低至7折
    一个资源只可评论一次,评论内容不能少于5个字
    stey_navy 正在学习CLI,不过应该有新版了吧
    2015-06-13
    回复
    zjp8023 不错 ,企得一看。好好看吧
    2013-09-15
    回复
    kingcs1013 很清楚, 当作参考书查阅。
    2013-09-01
    回复
    xylhh2008 下载下来看看,挺清楚的反正
    2013-02-19
    回复
    • 分享宗师

      成功上传21个资源即可获取
    关注 私信 TA的资源
    上传资源赚积分,得勋章
    最新推荐
    C++/CLI Standard.pdf 15积分/C币 立即下载
    1/127
    C++/CLI Standard.pdf第1页
    C++/CLI Standard.pdf第2页
    C++/CLI Standard.pdf第3页
    C++/CLI Standard.pdf第4页
    C++/CLI Standard.pdf第5页
    C++/CLI Standard.pdf第6页
    C++/CLI Standard.pdf第7页
    C++/CLI Standard.pdf第8页
    C++/CLI Standard.pdf第9页
    C++/CLI Standard.pdf第10页
    C++/CLI Standard.pdf第11页
    C++/CLI Standard.pdf第12页
    C++/CLI Standard.pdf第13页
    C++/CLI Standard.pdf第14页
    C++/CLI Standard.pdf第15页
    C++/CLI Standard.pdf第16页
    C++/CLI Standard.pdf第17页
    C++/CLI Standard.pdf第18页
    C++/CLI Standard.pdf第19页
    C++/CLI Standard.pdf第20页

    试读已结束,剩余107页未读...

    15积分/C币 立即下载 >