HP C Programmer's Guide MPE/iX 5.0 Documentation
HP C Programmer's Guide
Table of Contents
HP C Programmer's Guide
HP C Programmer's Guide : COPYRIGHT NOTICE
Ch 1. Introduction to HP C
HP C Online Help
Accessing HP C Help with the HP VUE Front Panel
Accessing HP C Help with the helpview Command
Ch 2. Storage and Alignment Comparisons
Data Type Alignments
Bit-Field Alignment
Array Size and Alignment
Alignment within Structures
HP C/HP-UX Series 700/800 and HP C/iX
HP C on the Series 300/400
CCS/C on the HP 1000 and HP 3000
VAX/VMS C
Aligning Structures between Architectures
Declaring the HP_ALIGN Pragma
Using the HP_ALIGN Pragma
Accessing Non-Natively Aligned Data with Pointers
Defining Platform Independent Data Structures
Ch 3. Calling Other Languages and MPE/iX Intrinsics
Comparing HP C and HP Pascal
Notes on HP C and HP Pascal
Passing Parameters Between HP C and HP Pascal
Linking HP Pascal Routines on HP-UX
Linking HP Pascal Routines on MPE/iX
Comparing HP C and HP FORTRAN 77
Notes on HP C and HP FORTRAN 77
Mixing C and FORTRAN File I/O
Passing Parameters Between HP C and HP FORTRAN 77
Linking HP FORTRAN 77 Routines on HP-UX
Linking HP FORTRAN 77 Routines on MPE/iX
Comparing Structured Data Type Declarations
Calling MPE/iX Intrinsics
Specifying the Intrinsic Pragma
Calling HPFOPEN
Declaring MPE/iX Intrinsics as External Functions
Sample Program Using MPE/iX File System Intrinsics
Ch 4. Optimizing HP C Programs
Summary of Major Optimization Levels
Supporting Optimization Options
Enabling Basic Optimization
Enabling Different Levels of Optimization on HP-UX
Level 1 Optimization
Level 2 Optimization
Level 3 Optimization
Level 4 Optimization
Invoking Level 1 and 2 Optimizations on MPE/iX
Level 1 Optimization
Level 2 Optimization
Changing the Aggressiveness of Optimizations on HP-UX
Enabling Only Conservative Optimizations on HP-UX
Enabling Aggressive Optimizations on HP-UX
Removing Compilation Time Limits When Optimizing on HP-UX
Limiting the Size of Optimized Code on HP-UX
Specifying Maximum Optimization on HP-UX
Combining Optimization Parameters on HP-UX
Summary of Optimization Parameters on HP-UX
Profile-Based Optimization
Instrumenting the Code
Collecting Data for Profiling
Performing Profile-Based Optimization
Maintaining Profile Data Files
Maintaining Instrumented and Optimized Program Files
Profile-Based Optimization Notes
Controlling Specific Optimizer Features on HP-UX
Using Advanced Optimization Options on HP-UX
Level 1 Optimization Modules
Branch Optimization
Dead Code Elimination
Faster Register Allocation
Instruction Scheduler
Peephole Optimizations
Level 2 Optimization Modules
Coloring Register Allocation
Induction Variables and Strength Reduction
Local and Global Common Subexpression Elimination
Constant Folding and Propagation
Loop Invariant Code Motion
Store/Copy Optimization
Unused Definition Elimination
Software Pipelining
Example
Prerequisites of Pipelining
Register Reassociation
Level 3 Optimizations
Inlining within a Single Source File
Example of Inlining
Level 4 Optimizations
Inlining Across Multiple Files
Global and Static Variable Optimization
Global Variable Optimization Coding Standards
Guidelines for Using the Optimizer
Optimizer Assumptions
Optimizer Pragmas
Optimizer Control Pragmas
Inlining Pragmas
Alias Pragmas
NO_SIDE_EFFECTS Pragma
ALLOCS_NEW_MEMORY pragma
FLOAT_TRAPS_ON pragma
Ch 5. Programming for Portability
Guidelines for Portability
Examples
Practices to Avoid
General Portability Considerations
Data Type Sizes and Alignments
Accessing Unaligned Data
Checking for Alignment Problems with lint
Ensuring Alignment without Pragmas
Casting Pointer Types
Type Incompatibilities and typedef
Conditional Compilation
Isolating System-Dependent Code with ##include Files
Parameter Lists
The char Data Type
Register Storage Class
Identifiers
Predefined Symbols
Shift Operators
The sizeof Operator
Bit-Fields
Floating-Point Exceptions
Integer Overflow
Overflow During Conversion from Floating Point to Integral Type
Structure Assignment
Structure-Valued Functions
Dereferencing Null Pointers
Expression Evaluation
Variable Initialization
Conversions between unsigned char or unsigned short and int
Temporary Files ($TMPDIR)
Compile Line Options
Input/Output
Checking for Standards Compliance
Porting to ANSI Mode HP C
ANSI Mode Compile Option (-Aa)
HP C Extensions to ANSI C (+e)
const and volatile Qualifiers
ANSI Mode Function Prototypes
Mixing Old-Style Function Definitions with ANSI Function Declarations
Function Prototype Considerations
Type Differences between Actual and Formal Parameters
Declaration of a Structure in a Prototype Parameter
Mixing of const and volatile Qualifiers and Function Prototypes
Using Name Spaces in HP C and ANSI C
HP Header File and LibraryImplementation of Name Spaces
Silent Changes for ANSI C
Porting between HP C and Domain/C
Porting between HP C and VMS C
Core Language Features
Preprocessor Features
Compiler Environment
Calling Other Languages
Calling FORTRAN
Calling Pascal
Ch 6. Migrating C Programs to HP-UX
Migrating an Application
Byte Order
Data Alignment
Unsupported Keywords
Predefined Macro Names
White Space
Hexadecimal Escape Sequence
Invalid Structure References
Leading Underscore
Library Functions
Floating-Point Format
Bit-Fields
Data Storage and Alignment
Typedefs
Ch 7. Using C Programming Tools
Description of C Programming Tools
HP Specific Features of lex and yacc
Using lint
Directives
Problem Detection
Unused Variables and Functions
Suppressing Unused Functions and Variables Reports
Set/Used Information
Unreachable Code
Function Value
Portability
Alignment Portability
Strange Constructions
Standards Compliance
INDEX
Index
MPE/iX 5.0 Documentation