Programming in standard C and C++

Introduction to programming in standard C and C++
        Summary of contents
                Creating an executable
                Advanced programming utilities
                Program analysis
                C and C++ compilation
        C language
                Modular programming in C
        C++ language
        Libraries and header files
                How C and C++ programs communicate with the shell
        Other tools

C and C++ compilation system
        Compiling and linking
                Components of the C compilation system
                        C preprocessor
                        C compiler
                        C assembler
                        C linker
                        Organization of the C compilation system
                Components of the C++ compilation system
                        C++ preprocessor
                        C++ compiler
                        C++ assembler
                        C++ prelinker
                        C++ linker
                        C++ name filter
                        Organization of the C++ compilation system
                Basic cc and CC command line syntax
                        hello world program
                        Creating the executable
                        Executing the program
                        Specifying a different executable name
                        Invoking the preprocessor only
                        Invoking the preprocessor and compiler only
                        Suppressing the linker phase
                        Passing files to cc and CC
                        Compiling multiple source files
                        A note on command line options
                Commonly used command line options
                        Searching for a header file
                        Preparing your program for debugging
                        Preparing your program for profiling
                        Optimizing your program
                        Software administration
                Link editing
                        Static linking
                        Dynamic linking
                        Default arrangement
                        Linking with standard libraries
                        Turning off dynamic linking
                        Linking with other standard libraries
                        Creating and linking with archive libraries
                        Creating and linking with C shared object libraries
                        Naming your shared object
                        Linking a shared object with another library
                        Specifying directories to be searched by the link editor
                        Specifying directories to be searched by the dynamic linker
                        Handling multiply defined symbols
                Checking for run-time compatibility
                Dynamic linking programming interface
                Guidelines for building shared objects
                        Minimize the library's data segment.
                        Minimize paging activity.
                Library maintenance
                C++ and dynamic linking
                        Building a C++ shared object
                        Static constructors and destructors
                        Diagnostics from the dynamic linker
                C++ external function name encoding
                Accessing C functions from C++
                Quick-reference guide
        Libraries and header files
                Header files
                C++ precompiled headers
                        Automatic precompiled header processing
                        Manual precompiled header processing
                        Other ways to control precompiled headers
                        Performance issues
                How to use library functions
                C library (libc)
                        Subsection 3S routines
                        Subsection 3C routines
                        System calls
                Math library (libm)
                General purpose library (libgen)
                Standard I/O
                        Standard files
                        Named files
                        Passing command line arguments
                Reentrant libraries
                BSD system libraries and header files
                        Accessing BSD libraries and header files

C language compilers
        Compilation modes
                Feature test macros
                Global behavior
                Phases of translation
        Source files and tokenization
                        Integral constants
                        Floating point constants
                        Character constants
                        Wide characters and multibyte characters
                String literals
                Wide string literals
                Trigraph sequences
                Preprocessing tokens
                        Preprocessing numbers
                Preprocessing directives
                        Preprocessing operators
                        Macro definition and expansion
                        File inclusion
                        Conditional compilation
                        Line control
                        Version control
                        Error generation
                        Predefined names
        Declarations and definitions
                Basic types
                        Type qualifiers
                        Structures and unions
                Storage duration
                Storage class specifiers
                        Pointer declarators
                        Array declarators
                        Function declarators
                Function definitions
        Conversions and expressions
                Implicit conversions
                        Characters and integers
                        Signed and unsigned integers
                        Integral and floating
                        Float and double
                        Usual arithmetic conversions
                        Objects and lvalues
                        Primary expressions
                        Unary operators
                        Cast operators - explicit conversions
                        Multiplicative operators
                        Additive operators
                        Bitwise shift operators
                        Relational operators
                        Equality operators
                        Bitwise AND operator
                        Bitwise exclusive OR operator
                        Bitwise OR operator
                        Logical AND operator
                        Logical OR operator
                        Conditional operator
                        Assignment expressions
                        Comma operator
                        Structure operators
                Associativity and precedence of operators
                Constant expressions
                Expression statement
                Compound statement
                Selection statements
                Iteration statements
                Jump statements
        Portability considerations

Complying with standard C
        Mixing old and new style functions
                Writing new code
                Updating existing code
                Mixing considerations
        Functions with varying arguments
        Promotions: unsigned vs. value preserving
                Compilation behavior
                First example: using a cast
                Second example: result is the same
                Integral constants
                Third example: integral constants
        Tokenization and preprocessing
                ANSI C translation phases
                Old C translation phases
                Logical source lines
                Macro replacement
                Token pasting
        Using const and volatile
                Types for lvalues
                Type qualifiers in derived types
                Using const to read character values
                        Examples of const usage
                When to use volatile
                        Examples of volatile usage
        Multibyte characters and wide characters
                ``Asianization'' means multibyte characters
                Encoding variations
                Wide characters
                Conversion functions
                C language features
        Standard headers and reserved names
                Balancing process
                Standard headers
                Names reserved for implementation use
                Names reserved for expansion
                Names safe to use
                The setlocale function
                Changed functions
                New functions
        Grouping and evaluation in expressions
                The Kernighan and Ritchie C rearrangement license
                The ANSI C rules
                Parentheses grouping and evaluation
                The ``As If'' rule
        Incomplete types
                Completing incomplete types
        Compatible and composite types
                Multiple declarations
                Separate compilation compatibility
                Single compilation compatibility
                Compatible pointer types
                Compatible array types
                Compatible function types
                Special cases
                Composite type

C++ language
        Compilation modes
        C++ dialect accepted
                Normal C++ mode
                Extensions accepted in normal C++ mode
                Anachronisms accepted
                Extensions accepted in cfront transition mode

Instantiating C++ templates
        The instantiation problem
        Coding standards for template definitions
        Manual instantiation
                Pragma interface
                Instantiation via the command line
                Single files
        Automatic instantiation
                Dependency management
                What can go wrong
        Other considerations
                More on linking template code into archives
                The one instantiation per object scheme
                Special symbols

Using C++ exception handling
        Performance implications
        Mixed language programming
        Other implementation dependencies

Compiler diagnostics
        C compiler diagnostics
                Message types and applicable options
                Operator names in messages
        Other error messages
        C++ compiler diagnostics

Object files
        File format
        Data representation
        ELF header
                ELF identification
                Rules for linking unrecognized sections
                Special sections
        String table
        Symbol table
                Symbol values
        Program header
                Base address
                Segment permissions
                        Segment contents
                        Note section
        Program loading (Processor specific)
        Dynamic linking
                Program interpreter
                Dynamic linker
                Dynamic section
                Shared object dependencies
                        Substitution sequences
                Global offset table
                Procedure linkage table
                Hash table
                Initialization and termination functions

Floating point operations
        IEEE arithmetic
                Data types and formats
                Normalized numbers
                Denormalized numbers
                        Maximum and minimum representable floating point values
                Special-case values
                NaNs and infinities
                Rounding control
                Exceptions, sticky bits, and trap bits
        Single-precision floating point operations
        IEEE requirements
                Conversion of floating point formats to integer
                Square root
                Compares and unordered condition

Analyzing your code with lint
        Why lint is an important tool
                Options and directives
                lint and the compiler
                Message formats
        What lint does
                Consistency checks
                Portability checks
                Suspicious constructs
                lint libraries
                lint filters
                Options and directives listed
        lint-specific messages

m4 macro processor
        Defining macros
        Arithmetic built-ins
        File inclusion
        System command
        String manipulation

Linking with the mapfile option
        Using the mapfile option
                Mapfile structure and syntax
                Segment declarations
                Mapping directives
                Size-symbol declarations
        Mapping example
        Mapfile option defaults
        Internal map structure
        Error messages
                Fatal errors

Enhanced asm facility
        Definition of terms
        Using asm macros
                        Storage modes
                        asm body
        Writing asm macros