Anda di halaman 1dari 243
~ BORLAND C+ 30 PROGRAMMER’S GUIDE LANGUAGE STRUCTURE WH CLASS LIBRARIES I ADVANCED PROGRAMMING TECHNIQUES, ANSI C IMPLEMENTATION BORLAND Borland’ C++ Version 3.0 Programmer's Guide BORLAND INTERNATIONAL NC. 180 GREEN HLLS ROAD PO.Boxee0001,SCOmSVALLEYCA F067 20 Rt Copyright © 1991 by Borland Intemational, Al tights reserved, All Borland products are traclemarks oF registered traciemarks of Borland Intemational, nc. Other brand and product names are trodomats of registered fraclormarks of Ihr respective NOES Windows, as used in this manual, shail refer to Microsoft's Implementation of a windows system. woa7ssase Introduction What's in this book | Anintroduction to the formal definitions Syntax and terminology Chapter 1 Lexical elements Whitespace : Line splicing with \ Comments C comments Nested comments Cr+ comments Comment delimiters and whitespace Tokens Keywords Kentifiers . Naming and length restritions Identifiers and case sensitivity Uniqueness and scope Constants Integer constants Decimal constants Octal constants Hexadecimal constants Long and unsigned suffixes ‘Character constants : Escape sequences Borland C++ special two-character constants Signed and unsigned char Wide character constants Floating,point constants Floating-point constants—data types Enumeration constants String literals 10 10 10 n ul i i 2 B B u “4 15 15 16 16 16 7 18 Constants and internal representation Constant expressions Punctuators Brackets Parentheses Braces Comma Semicolon Colon Ellipsis Asterisk (pointer declaration) Equal sign (initializer) Pound sign (preprocessor directive) Chapter 2 Language structure Declarations Objects Lvalues Rvalues ‘Types and storage classes Scope Block scope Funetion scope Function prototype scope File scope Class scope (C+¥) Scope and name spaces Visibility Duration Static duration Local duration Dynamic duration ‘Translation units Linkage Name mangling