C++/CLI Language Specification

Specification du langage C++/CLI

General Information

Status
Published
Current Stage
4098 - Project deleted
Start Date
19-May-2008
Completion Date
19-May-2008
Ref Project

Buy Standard

Standard
ISO/IEC FCD 26926 - C++/CLI Language Specification
English language
300 pages
sale 15% off
Preview
sale 15% off
Preview

Standards Content (sample)

DRAFT INTERNATIONAL STANDARD ISO/IEC 26926
Attributed to ISO/IEC JTC 1 by the Central Secretariat (see page iii)
Voting begins on Voting terminates on
2006-03-09 2006-08-09

INTERNATIONAL ORGANIZATION FOR STANDARDIZATION • МЕЖДУНАРОДНАЯ ОРГАНИЗАЦИЯ ПО СТАНДАРТИЗАЦИИ • ORGANISATION INTERNATIONALE DE NORMALISATION

INTERNATIONAL ELECTROTECHNICAL COMMISSION • МЕЖДУНАРОДНАЯ ЭЛЕКТРОТЕХНИЧЕСКАЯ КОММИСИЯ • COMMISSION ÉLECTROTECHNIQUE INTERNATIONALE

FAST-TRACK PROCEDURE
C++/CLI Language Specification
Specification du langage C++/CLI
ICS 35.060

In accordance with the provisions of Council Resolution 21/1986 this DIS is circulated in the

English language only.

Conformément aux dispositions de la Résolution du Conseil 21/1986, ce DIS est distribué en

version anglaise seulement.

THIS DOCUMENT IS A DRAFT CIRCULATED FOR COMMENT AND APPROVAL. IT IS THEREFORE SUBJECT TO CHANGE AND MAY NOT BE

REFERRED TO AS AN INTERNATIONAL STANDARD UNTIL PUBLISHED AS SUCH.

IN ADDITION TO THEIR EVALUATION AS BEING ACCEPTABLE FOR INDUSTRIAL, TECHNOLOGICAL, COMMERCIAL AND USER PURPOSES,

DRAFT INTERNATIONAL STANDARDS MAY ON OCCASION HAVE TO BE CONSIDERED IN THE LIGHT OF THEIR POTENTIAL TO BECOME

STANDARDS TO WHICH REFERENCE MAY BE MADE IN NATIONAL REGULATIONS.
International Organization for Standardization, 2006
International Electrotechnical Commission, 2006
---------------------- Page: 1 ----------------------
ISO/IEC DIS 26926
PDF disclaimer

This PDF file may contain embedded typefaces. In accordance with Adobe's licensing policy, this file may be printed or viewed but

shall not be edited unless the typefaces which are embedded are licensed to and installed on the computer performing the editing. In

downloading this file, parties accept therein the responsibility of not infringing Adobe's licensing policy. The ISO Central Secretariat

accepts no liability in this area.
Adobe is a trademark of Adobe Systems Incorporated.

Details of the software products used to create this PDF file can be found in the General Info relative to the file; the PDF-creation

parameters were optimized for printing. Every care has been taken to ensure that the file is suitable for use by ISO member bodies. In

the unlikely event that a problem relating to it is found, please inform the Central Secretariat at the address given below.

Copyright notice

This ISO document is a Draft International Standard and is copyright-protected by ISO. Except as permitted

under the applicable laws of the user's country, neither this ISO draft nor any extract from it may be

reproduced, stored in a retrieval system or transmitted in any form or by any means, electronic,

photocopying, recording or otherwise, without prior written permission being secured.

Requests for permission to reproduce should be addressed to either ISO at the address below or ISO's

member body in the country of the requester.
ISO copyright office
Case postale 56 • CH-1211 Geneva 20
Tel. + 41 22 749 01 11
Fax + 41 22 749 09 47
E-mail copyright@iso.org
Web www.iso.org
Reproduction may be subject to royalty payments or a licensing agreement.
Violators may be prosecuted.
ii © ISO/IEC 2006 — All rights reserved
---------------------- Page: 2 ----------------------
ISO/IEC DIS 26926
NOTE FROM ITTF

This draft International Standard is submitted for JTC 1 national body vote under the Fast-Track Procedure.

In accordance with Resolution 30 of the JTC 1 Berlin Plenary 1993, the proposer of this document recommends

assignment of ISO/IEC 26926 to JTC 1/SC 22.
“FAST-TRACK” PROCEDURE

1 Any P-member and any Category A liaison organization of ISO/IEC JTC 1 may propose that an existing

standard from any source be submitted directly for vote as a DIS. The criteria for proposing an existing

standard for the fast-track procedure are a matter for each proposer to decide.

2 The proposal shall be received by the ITTF which will take the following actions.

2.1 To settle the copyright and/or trade mark situation with the proposer, so that the proposed text can be

freely copied and distributed within JTC 1 without restriction.

2.2 To assess in consultation with the JTC 1 secretariat which SC is competent for the subject covered by

the proposed standard and to ascertain that there is no evident contradiction with other International

Standards.

2.3 To distribute the text of the proposed standard as a DIS. In case of particularly bulky documents the ITTF

may demand the necessary number of copies from the proposer.

3 The period for combined DIS voting shall be six months. In order to be accepted the DIS must be

supported by 75 % of the votes cast (abstention is not counted as a vote) and by two-thirds of the P-members

voting of JTC 1.

4 At the end of the voting period, the comments received, whether editorial only or technical, will be dealt

with by a working group appointed by the secretariat of the relevant SC.

5 If, after the deliberations of this WG, the requirements of 3 above are met, the amended text shall be sent

to the ITTF by the secretariat of the relevant SC for publication as an International Standard.

If it is impossible to agree to a text meeting the above requirements, the proposal has failed and the procedure

is terminated.

In either case the WG shall prepare a full report which will be circulated by the ITTF.

6 If the proposed standard is accepted and published, its maintenance will be handled by JTC 1.

© ISO/IEC 2006 — All rights reserved iii
---------------------- Page: 3 ----------------------
ECMA-372
1 Edition / December 2005
C++/CLI Language
Specification
---------------------- Page: 4 ----------------------
Standard
ECMA-372
1 Edition / December 2005
C++/CLI Language
Specification

Ecma International Rue du Rhône 114 CH-1204 Geneva T/F: +41 22 849 6000/01 www.ecma-international.org

---------------------- Page: 5 ----------------------
---------------------- Page: 6 ----------------------
Table of Contents
Table of Contents

Introduction...................................................................................................................................................xii

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 array 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 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 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

iii
---------------------- Page: 7 ----------------------
C++/CLI Language Specification

9.1.3 Literals ............................................................................................................................................ 39

9.1.4 Operators and punctuators .............................................................................................................. 40

10. Basic 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. Preprocessor ............................................................................................................................................ 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

12.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 ................................................................................................................................... 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 Lvalue conversions ....................................................................................................................... 64

14.2.4 Integral promotions....................................................................................................................... 64

14.2.5 String literal conversions .............................................................................................................. 65

14.2.6 Boxing conversions....................................................................................................................... 66

---------------------- Page: 8 ----------------------
Table of Contents

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 Explicit 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.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 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 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 Logical 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

---------------------- Page: 9 ----------------------
C++/CLI Language Specification

16.2 Iteration statements.............................................................................................................................. 89

16.2.1 The for each statement.................................................................................................................. 89

16.3 Jump statements................................................................................................................................... 91

16.3.1 The break statement ............................................
...

Questions, Comments and Discussion

Ask us and Technical Secretary will try to provide an answer. You can facilitate discussion about the standard in here.