ANSI ISO IEC 14882-2003(R2008) Programming languages — C++《程序设计语言.C++》.pdf

上传人:visitstep340 文档编号:437197 上传时间:2018-11-14 格式:PDF 页数:786 大小:2.68MB
下载 相关 举报
ANSI ISO IEC 14882-2003(R2008) Programming languages — C++《程序设计语言.C++》.pdf_第1页
第1页 / 共786页
ANSI ISO IEC 14882-2003(R2008) Programming languages — C++《程序设计语言.C++》.pdf_第2页
第2页 / 共786页
ANSI ISO IEC 14882-2003(R2008) Programming languages — C++《程序设计语言.C++》.pdf_第3页
第3页 / 共786页
ANSI ISO IEC 14882-2003(R2008) Programming languages — C++《程序设计语言.C++》.pdf_第4页
第4页 / 共786页
ANSI ISO IEC 14882-2003(R2008) Programming languages — C++《程序设计语言.C++》.pdf_第5页
第5页 / 共786页
亲,该文档总共786页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述

1、B CReference numberISO/IEC 14882:2003(E)INTERNATIONALSTANDARDISO/IEC14882Second edition2003-10-15Programming languages C+Langages de programmation C+Adopted by INCITS (InterNational Committee for Information Technology Standards) as an American National Standard.Date of ANSI Approval: 12/29/2003Publ

2、ished by American National Standards Institute,25 West 43rd Street, New York, New York 10036Copyright 2003 by Information Technology Industry Council (ITI).All rights reserved.These materials are subject to copyright claims of International Standardization Organization (ISO), InternationalElectrotec

3、hnical Commission (IEC), American National Standards Institute (ANSI), and Information Technology Industry Council(ITI). Not for resale. No part of this publication may be reproduced in any form, including an electronic retrieval system, withoutthe prior written permission of ITI. All requests perta

4、ining to this standard should be submitted to ITI, 1250 Eye Street NW,Washington, DC 20005.Printed in the United States of AmericaCopyright American National Standards Institute Provided by IHS under license with ANSINot for ResaleNo reproduction or networking permitted without license from IHS-,-,-

5、ISO/IEC 14882:2003(E) PDF disclaimer This PDF file may contain embedded typefaces. In accordance with Adobes 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 d

6、ownloading this file, parties accept therein the responsibility of not infringing Adobes 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

7、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 addre

8、ss given below. ISO/IEC 2003 All rights reserved. Unless otherwise specified, no part of this publication may be reproduced or utilized in any form or by any means, electronic or mechanical, including photocopying and microfilm, without permission in writing from either ISO at the address below or I

9、SOs 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 copyrightiso.org Web www.iso.org Published in Switzerland ii ISO/IEC 2003 All rights reservedCopyright American National Standards Institute Pro

10、vided by IHS under license with ANSINot for ResaleNo reproduction or networking permitted without license from IHS-,-,-ISO/IEC 14882:2003(E) ISO/IEC 2003 All rights reserved iiiContents1 General 11.1 Scope11.2 Normative references .11.3 Terms and definitions .11.3.1 argument .11.3.2 diagnostic messa

11、ge .21.3.3 dynamic type .21.3.4 ill-formed program21.3.5 implementation-defined behavior .21.3.6 implementation limits .21.3.7 locale-specific behavior 21.3.8 multibyte character .21.3.9 parameter 21.3.10 signature 21.3.11 static type 21.3.12 undefined behavior .21.3.13 unspecified behavior .31.3.14

12、 well-formed program 31.4 Implementation compliance.31.5 Structure of this International Standard .41.6 Syntax notation 41.7 The C + + memory model .41.8 The C + + object model 41.9 Program execution .5Copyright American National Standards Institute Provided by IHS under license with ANSINot for Res

13、aleNo reproduction or networking permitted without license from IHS-,-,-ISO/IEC 14882:2003(E) iv ISO/IEC 2003 All rights reserved1.10 Acknowledgments .82 Lexical conventions 92.1 Phases of translation 92.2 Character sets .102.3 Trigraph sequences 112.4 Preprocessing tokens .112.5 Alternative tokens

14、122.6 Tokens122.7 Comments 122.8 Header names .132.9 Preprocessing numbers 132.10 Identifiers .132.11 Keywords .142.12 Operators and punctuators .152.13 Literals .152.13.1 Integer literals .152.13.2 Character literals .162.13.3 Floating literals .182.13.4 String literals .192.13.5 Boolean literals .

15、193 Basic concepts 213.1 Declarations and definitions 213.2 One definition rule .223.3 Declarative regions and scopes 243.3.1 Point of declaration .253.3.2 Local scope .263.3.3 Function prototype scope 263.3.4 Function scope 273.3.5 Namespace scope 273.3.6 Class scope273.3.7 Name hiding283.4 Name lo

16、okup 293.4.1 Unqualified name lookup .293.4.2 Argument-dependent name lookup .323.4.3 Qualified name lookup .34Copyright American National Standards Institute Provided by IHS under license with ANSINot for ResaleNo reproduction or networking permitted without license from IHS-,-,-ISO/IEC 14882:2003(

17、E) ISO/IEC 2003 All rights reserved v3.4.3.1 Class members .353.4.3.2 Namespace members .353.4.4 Elaborated type specifiers .393.4.5 Class member access 403.4.6 Using-directives and namespace aliases .413.5 Program and linkage 413.6 Start and termination433.6.1 Main function433.6.2 Initialization of

18、 non-local objects .443.6.3 Termination.453.7 Storage duration .463.7.1 Static storage duration 463.7.2 Automatic storage duration.463.7.3 Dynamic storage duration .473.7.3.1 Allocation functions.473.7.3.2 Deallocation functions .483.7.4 Duration of sub-objects.483.8 Object Lifetime 493.9 Types523.9

19、.1 Fundamental types 533.9.2 Compound types .553.9.3 CV-qualifiers 553.10 Lvalues and rvalues .564 Standard conversions 594.1 Lvalue-to-rvalue conversion 594.2 Array-to-pointer conversion 604.3 Function-to-pointer conversion .604.4 Qualification conversions 604.5 Integral promotions 614.6 Floating p

20、oint promotion .614.7 Integral conversions .624.8 Floating point conversions .624.9 Floating-integral conversions 624.10 Pointer conversions 624.11 Pointer to member conversions .63Copyright American National Standards Institute Provided by IHS under license with ANSINot for ResaleNo reproduction or

21、 networking permitted without license from IHS-,-,-ISO/IEC 14882:2003(E) vi ISO/IEC 2003 All rights reserved4.12 Boolean conversions 635 Expressions .655.1 Primary expressions .665.2 Postfix expressions 685.2.1 Subscripting 685.2.2 Function call .685.2.3 Explicit type conversion (functional notation

22、) .705.2.4 Pseudo destructor call .705.2.5 Class member access 705.2.6 Increment and decrement 715.2.7 Dynamic cast 725.2.8 Type identification 735.2.9 Static cast 745.2.10 Reinterpret cast .755.2.11 Const cast 765.3 Unary expressions 785.3.1 Unary operators.785.3.2 Increment and decrement 795.3.3 S

23、izeof 795.3.4 New .805.3.5 Delete 835.4 Explicit type conversion (cast notation) 845.5 Pointer-to-member operators .855.6 Multiplicative operators .855.7 Additive operators .865.8 Shift operators 875.9 Relational operators .875.10 Equality operators 885.11 Bitwise AND operator 895.12 Bitwise exclusi

24、ve OR operator .895.13 Bitwise inclusive OR operator .895.14 Logical AND operator 895.15 Logical OR operator .905.16 Conditional operator 905.17 Assignment operators 91Copyright American National Standards Institute Provided by IHS under license with ANSINot for ResaleNo reproduction or networking p

25、ermitted without license from IHS-,-,-ISO/IEC 14882:2003(E) ISO/IEC 2003 All rights reserved vii5.18 Comma operator 925.19 Constant expressions .926 Statements .956.1 Labeled statement 956.2 Expression statement .956.3 Compound statement or block .956.4 Selection statements.966.4.1 The if statement

26、976.4.2 The switch statement 976.5 Iteration statements 976.5.1 The while statement .986.5.2 The do statement 986.5.3 The for statement996.6 Jump statements .996.6.1 The break statement .996.6.2 The continue statement1006.6.3 The return statement 1006.6.4 The goto statement .1006.7 Declaration state

27、ment 1006.8 Ambiguity resolution .1017 Declarations 1037.1 Specifiers .1047.1.1 Storage class specifiers .1057.1.2 Function specifiers 1067.1.3 The typedef specifier1077.1.4 The friend specifier 1087.1.5 Type specifiers 1087.1.5.1 The cv-qualifiers1097.1.5.2 Simple type specifiers 1107.1.5.3 Elabora

28、ted type specifiers 1117.2 Enumeration declarations 1127.3 Namespaces .1147.3.1 Namespace definition .1147.3.1.1 Unnamed namespaces 1157.3.1.2 Namespace member definitions .1157.3.2 Namespace alias 1177.3.3 The using declaration 1177.3.4 Using directive 1237.4 The asm declaration 126Copyright Americ

29、an National Standards Institute Provided by IHS under license with ANSINot for ResaleNo reproduction or networking permitted without license from IHS-,-,-ISO/IEC 14882:2003(E) viii ISO/IEC 2003 All rights reserved7.5 Linkage specifications .1268 Declarators 1318.1 Type names 1328.2 Ambiguity resolut

30、ion .1328.3 Meaning of declarators 1348.3.1 Pointers .1358.3.2 References .1358.3.3 Pointers to members .1368.3.4 Arrays .1378.3.5 Functions.1388.3.6 Default arguments .1418.4 Function definitions .1448.5 Initializers 1458.5.1 Aggregates 1478.5.2 Character arrays 1508.5.3 References .1509 Classes 15

31、39.1 Class names .1539.2 Class members .1559.3 Member functions 1579.3.1 Nonstatic member functions .1589.3.2 The this pointer .1609.4 Static members.1609.4.1 Static member functions .1619.4.2 Static data members 1619.5 Unions 1629.6 Bit-fields 1639.7 Nested class declarations .1649.8 Local class de

32、clarations .1659.9 Nested type names .16610 Derived classes .16710.1 Multiple base classes .16810.2 Member name lookup 16910.3 Virtual functions 172Copyright American National Standards Institute Provided by IHS under license with ANSINot for ResaleNo reproduction or networking permitted without lic

33、ense from IHS-,-,-ISO/IEC 14882:2003(E) ISO/IEC 2003 All rights reserved ix10.4 Abstract classes 17611 Member access control .17911.1 Access specifiers 18011.2 Accessibility of base classes and base class members .18111.3 Access declarations 18211.4 Friends .18311.5 Protected member access .18611.6

34、Access to virtual functions.18711.7 Multiple access 18811.8 Nested classes 18812 Special member functions.18912.1 Constructors .18912.2 Temporary objects .19112.3 Conversions .19212.3.1 Conversion by constructor 19312.3.2 Conversion functions 19412.4 Destructors .19512.5 Free store .19812.6 Initiali

35、zation .19912.6.1 Explicit initialization 20012.6.2 Initializing bases and members .20112.7 Construction and destruction .20412.8 Copying class objects 20713 Overloading 21313.1 Overloadable declarations21313.2 Declaration matching .21513.3 Overload resolution .21613.3.1 Candidate functions and argu

36、ment lists 21713.3.1.1 Function call syntax .21813.3.1.1.1 Call to named function21813.3.1.1.2 Call to object of class type 21913.3.1.2 Operators in expressions 220Copyright American National Standards Institute Provided by IHS under license with ANSINot for ResaleNo reproduction or networking permi

37、tted without license from IHS-,-,-ISO/IEC 14882:2003(E) x ISO/IEC 2003 All rights reserved13.3.1.3 Initialization by constructor .22213.3.1.4 Copy-initialization of class by user-defined conversion22213.3.1.5 Initialization by conversion function .22213.3.1.6 Initialization by conversion function fo

38、r direct reference binding 22313.3.2 Viable functions 22313.3.3 Best Viable Function 22313.3.3.1 Implicit conversion sequences .22513.3.3.1.1 Standard conversion sequences 22713.3.3.1.2 User-defined conversion sequences 22713.3.3.1.3 Ellipsis conversion sequences.22813.3.3.1.4 Reference binding .228

39、13.3.3.2 Ranking implicit conversion sequences.22813.4 Address of overloaded function .23013.5 Overloaded operators .23213.5.1 Unary operators.23313.5.2 Binary operators23313.5.3 Assignment .23313.5.4 Function call .23413.5.5 Subscripting 23413.5.6 Class member access 23413.5.7 Increment and decreme

40、nt 23413.6 Built-in operators .23514 Templates 23914.1 Template parameters 24014.2 Names of template specializations .24214.3 Template arguments.24414.3.1 Template type arguments 24514.3.2 Template non-type arguments 24614.3.3 Template template arguments .24814.4 Type equivalence .24814.5 Template d

41、eclarations 24914.5.1 Class templates .24914.5.1.1 Member functions of class templates.24914.5.1.2 Member classes of class templates 25014.5.1.3 Static data members of class templates25014.5.2 Member templates 25114.5.3 Friends 25214.5.4 Class template partial specializations .25414.5.4.1 Matching o

42、f class template partial specializations 25614.5.4.2 Partial ordering of class template specializations 25714.5.4.3 Members of class template specializations 25714.5.5 Function templates 25814.5.5.1 Function template overloading 25914.5.5.2 Partial ordering of function templates .260Copyright Americ

43、an National Standards Institute Provided by IHS under license with ANSINot for ResaleNo reproduction or networking permitted without license from IHS-,-,-ISO/IEC 14882:2003(E) ISO/IEC 2003 All rights reserved xi14.6 Name resolution .26114.6.1 Locally declared names 26414.6.2 Dependent names 26714.6.

44、2.1 Dependent types.26814.6.2.2 Type-dependent expressions 26814.6.2.3 Value-dependent expressions 26914.6.2.4 Dependent template arguments 26914.6.3 Non-dependent names.27014.6.4 Dependent name resolution 27014.6.4.1 Point of instantiation 27014.6.4.2 Candidate functions .27114.6.5 Friend names dec

45、lared within a class template .27114.7 Template instantiation and specialization 27214.7.1 Implicit instantiation .27314.7.2 Explicit instantiation .27614.7.3 Explicit specialization .27714.8 Function template specializations 28214.8.1 Explicit template argument specification .28314.8.2 Template arg

46、ument deduction 28514.8.2.1 Deducing template arguments from a function call .28714.8.2.2 Deducing template arguments taking the address of a function template .28814.8.2.3 Deducing conversion function template arguments.28814.8.2.4 Deducing template arguments from a type 28814.8.3 Overload resoluti

47、on 29315 Exception handling .29715.1 Throwing an exception 29815.2 Constructors and destructors30015.3 Handling an exception .30015.4 Exception specifications 30215.5 Special functions 30415.5.1 The terminate() function 30415.5.2 The unexpected() function 30515.5.3 The uncaught_exception() function

48、.30515.6 Exceptions and access 30516 Preprocessing directives .30716.1 Conditional inclusion .30816.2 Source file inclusion 30916.3 Macro replacement 31016.3.1 Argument substitution 31116.3.2 The # operator 31116.3.3 The # operator 312Copyright American National Standards Institute Provided by IHS u

49、nder license with ANSINot for ResaleNo reproduction or networking permitted without license from IHS-,-,-ISO/IEC 14882:2003(E) xii ISO/IEC 2003 All rights reserved16.3.4 Rescanning and further replacement.31216.3.5 Scope of macro definitions .31216.4 Line control 31416.5 Error directive 31416.6 Pragma direc

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 标准规范 > 国际标准 > ANSI

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