
Programming in standard C and C++ Programming in standard C and C++ Table of Contents Introduction to programming in standard C and C++...................................................................................1 Summary of contents...............................................................................................................................1 Creating an executable......................................................................................................................1 Advanced programming utilities.......................................................................................................2 Program analysis...............................................................................................................................2 C and C++ compilation.....................................................................................................................2 C language...............................................................................................................................................4 Modular programming in C...............................................................................................................4 C++ language...........................................................................................................................................4 Libraries and header files.........................................................................................................................5 How C and C++ programs communicate with the shell...................................................................5 Other tools................................................................................................................................................6 C and C++ compilation system..........................................................................................................................7 Compiling and linking.............................................................................................................................7 Components of the C compilation system.........................................................................................7 Components of the C++ compilation system....................................................................................9 Basic cc and CC command line syntax...........................................................................................10 Commonly used command line options..........................................................................................14 Link editing.....................................................................................................................................17 Checking for run−time compatibility..............................................................................................26 Dynamic linking programming interface........................................................................................27 Guidelines for building shared objects............................................................................................27 Library maintenance........................................................................................................................30 C++ and dynamic linking................................................................................................................31 C++ external function name encoding............................................................................................32 Accessing C functions from C++....................................................................................................34 Quick−reference guide....................................................................................................................35 Libraries and header files.......................................................................................................................36 Header files......................................................................................................................................37 C++ precompiled headers................................................................................................................38 How to use library functions...........................................................................................................42 C library (libc).................................................................................................................................43 Math library (libm)..........................................................................................................................46 General purpose library (libgen).....................................................................................................49 Standard I/O....................................................................................................................................50 Reentrant libraries...........................................................................................................................53 BSD system libraries and header files.............................................................................................54 C language compilers........................................................................................................................................55 Compilation modes................................................................................................................................55 Feature test macros..........................................................................................................................56 Global behavior...............................................................................................................................56 Phases of translation........................................................................................................................57 Source files and tokenization.................................................................................................................58 Tokens.............................................................................................................................................58 Identifiers.........................................................................................................................................58 Keywords.........................................................................................................................................58 i Programming in standard C and C++ Table of Contents C language compilers Constants.........................................................................................................................................58 String literals...................................................................................................................................61 Wide string literals..........................................................................................................................61 Comments........................................................................................................................................61 Preprocessing.........................................................................................................................................61 Trigraph sequences..........................................................................................................................62 Preprocessing tokens.......................................................................................................................62 Preprocessing directives..................................................................................................................63 Declarations and definitions..................................................................................................................69 Basic types.......................................................................................................................................69 Scope...............................................................................................................................................71 Storage duration..............................................................................................................................72 Storage class specifiers....................................................................................................................72 Declarators.......................................................................................................................................73 Function definitions.........................................................................................................................75 Conversions and expressions.................................................................................................................75 Implicit conversions........................................................................................................................75 Expressions......................................................................................................................................77 Operators.........................................................................................................................................77 Associativity and precedence of operators......................................................................................84 Constant expressions.......................................................................................................................84
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages338 Page
-
File Size-