HPlogo

HP C/HP-UX Programmer's Guide: Workstations and Servers

» 

Technical documentation

Complete book in PDF

 » Table of Contents

 » Index

HP Part Number: 92434-90011

Published: May 1997


Table of Contents

Printing History
About This Manual
Conventions
Related Documents
1 Introduction to HP C
HP C Online Help
Accessing HP C Help with the +help Option
Accessing HP C Help with the Front Panel
Accessing HP C Help with the dthelpview Command
2 Storage and Alignment Comparisons
Data Type Size and Alignments
Alignment Rules
Alignment of Scalar Types
Alignment of Arrays
Alignment of Structures and Unions
Alignment of Bit-Fields
Alignment of Typedefs
The HP_ALIGN Pragma
Using the HP_ALIGN Pragma
Defining Platform Independent Data Structures
Aligning Structures Between Architectures
Examples of Structure Alignment on Different Systems
3 Calling Other Languages
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
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
Comparing Structured Data Type Declarations
4 Optimizing HP C Programs
Summary of Major Optimization Levels
Supporting Optimization Options
Enabling Basic Optimization
Enabling Different Levels of Optimization
Level 1 Optimization
Level 2 Optimization
Level 3 Optimization
Level 4 Optimization
Changing the Aggressiveness of Optimizations
Enabling Only Conservative Optimizations
Enabling Aggressive Optimizations
Removing Compilation Time Limits When Optimizing
Limiting the Size of Optimized Code
Specifying Maximum Optimization
Combining Optimization Parameters
Summary of Optimization Parameters
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
+O[no]dataprefetch
+O[no]entrysched
+O[no]fail_safe
+O[no]fastaccess
+O[no]fltacc
+O[no]global_ptrs_unique [=name1,name2, ...nameN]
+O[no]initcheck
+O[no]inline[=name1, name2, ...nameN]
+Oinline_budget[=n]
+O[no]libcalls
+O[no]loop_transform
+O[no]loop_unroll[=unroll factor]
+O[no]moveflops
+O[no]parallel
+O[no]parmsoverlap
+O[no]pipeline
+O[no]procelim
+O[no]ptrs_ansi
+O[no]ptrs_strongly_typed
+O[no]ptrs_to_globals[=name1, name2, ...nameN]
+O[no]regionsched
+O[no]regreassoc
+O[no]sideeffects=[name1, name2, ...nameN]
+O[no]signedpointers
+O[no]static_prediction
+O[no]vectorize
+O[no]volatile
+O[no]whole_program_mode
Using Advanced Optimization Options
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
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
Guidelines for Using the Optimizer
Optimizer Assumptions
Optimizer Pragmas
Optimizer Control Pragmas
Inlining Pragmas
Alias Pragmas
[NO]PTRS_STRONGLY_TYPED Pragma
Aliasing Options
Parallel Execution
Transforming Eligible Loops for Parallel Execution (+Oparallel)
Environment Variable for Parallel Programs
Parallelizing C Programs
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)
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
Using Name Spaces in HP C and ANSI C
HP Header File and Library Implementation 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
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
7 Using C Programming Tools
Description of C Programming Tools
HP Specific Features of lex and yacc
Using lint
Directives
Problem Detection
Index
© Hewlett-Packard Development Company, L.P.