Z/OS XL C/C++ Language Reference Z/OS XL C/C++ and Related Documents
Total Page:16
File Type:pdf, Size:1020Kb
z/OS Version 2 Release 4 XL C/C++ Language Reference IBM SC14-7308-40 Note Before using this information and the product it supports, read the information in “Notices” on page 551. This edition applies to Version 2 Release 4 of z/OS (5650-ZOS) and to all subsequent releases and modifications until otherwise indicated in new editions. Last updated: 2020-12-14 © Copyright International Business Machines Corporation 1998, 2019. US Government Users Restricted Rights – Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. Contents About this document...........................................................................................xiii Who should read this document............................................................................................................... xiii How to use this document.........................................................................................................................xiii How this document is organized............................................................................................................... xiii Conventions............................................................................................................................................... xiii z/OS XL C/C++ and related documents................................................................ xix Chapter 1. Scope and linkage.................................................................................1 Scope............................................................................................................................................................1 Block/local scope................................................................................................................................... 2 Function scope....................................................................................................................................... 2 Function prototype scope...................................................................................................................... 3 File/global scope.................................................................................................................................... 3 Examples of scope in C...........................................................................................................................3 Class scope (C++ only)........................................................................................................................... 4 Namespaces of identifiers......................................................................................................................4 Name hiding (C++ only)..........................................................................................................................5 Lifetime of C++ temporaries (C++ only).................................................................................................6 Program linkage........................................................................................................................................... 9 Internal linkage.......................................................................................................................................9 External linkage....................................................................................................................................10 No linkage.............................................................................................................................................10 Language linkage (C++ only)................................................................................................................ 11 Chapter 2. Lexical elements................................................................................. 15 Tokens........................................................................................................................................................ 15 Keywords.............................................................................................................................................. 15 Identifiers............................................................................................................................................. 18 Literals.................................................................................................................................................. 20 Punctuators and operators.................................................................................................................. 31 Source program character set................................................................................................................... 33 Multibyte characters............................................................................................................................ 34 Escape sequences................................................................................................................................35 The Unicode standard.......................................................................................................................... 36 Digraph characters............................................................................................................................... 37 Trigraph sequences.............................................................................................................................. 38 Comments..................................................................................................................................................39 Chapter 3. Data objects and declarations............................................................. 41 Overview of data objects and declarations...............................................................................................41 Overview of data objects......................................................................................................................41 Overview of data declarations and definitions.................................................................................... 43 _Static_assert declaration (C11)...............................................................................................................44 static_assert declaration (C++11).............................................................................................................45 Storage class specifiers............................................................................................................................. 47 The auto storage class specifier.......................................................................................................... 47 The static storage class specifier.........................................................................................................48 The extern storage class specifier....................................................................................................... 49 The mutable storage class specifier (C++ only).................................................................................. 50 iii The register storage class specifier..................................................................................................... 50 Type specifiers........................................................................................................................................... 52 Integral types....................................................................................................................................... 52 Boolean types.......................................................................................................................................53 Floating-point types............................................................................................................................. 54 Fixed point decimal types (C only).......................................................................................................55 Character types ................................................................................................................................... 56 The void type........................................................................................................................................ 57 User-defined types...............................................................................................................................57 The auto type specifier (C++11).......................................................................................................... 71 The decltype(expression) type specifier (C++11)............................................................................... 72 The constexpr specifier (C++11)...............................................................................................................77 Compatibility of arithmetic types (C only).................................................................................................78 Type qualifiers............................................................................................................................................78 The __callback type qualifier............................................................................................................... 80 The const type qualifier........................................................................................................................81 The __far type qualifier (C only)...........................................................................................................81