HPlogo

HP-UX/HP C Compiler: HP C/HP-UX Reference Manual
HP 9000 Computers

» 

Technical documentation

Complete book in PDF

 » Table of Contents

HP Part Number: B3901-90003

Edition: Ninth Edition

Published: June 2000


Table of Contents

Printing History
About this Manual
Conventions
Related Documents
1 What is HP C?
ANSI Mode
Compatibility Mode
About HP C/HP-UX
HP C Online Help
Prerequisites for using HP C Online Help
Accessing HP C Online Help
X-Motif CDE Help is obsolete
2 Program Organization
Lexical Elements
White Space, Newlines, and Continuation Lines
Spreading Source Code Across Multiple Lines
Comments
Identifiers
Keywords
Declarations
Typedef Declarations
Abstract Global Types
Improving Portability
Simplifying Complex Declarations
Using typedefs for Arrays
Name Spaces
Declarations within code
Constants
Integer Constants
Floating-Point Constants
Character Constants
String Constants
Structuring a C Program
3 Data Types and Declarations
Program Structure
Syntax
Description
Declarations
Syntax
Description
New Declaration features
Examples
Storage-Class Specifiers
Syntax
Description
Type Specifiers
Syntax
Description
HP-Specific Type Qualifiers
Syntax
Description
Type Qualifiers
Syntax
Description
Structure and Union Specifiers
Syntax
Description
Structure and Union Tags
Enumeration
Syntax
Description
Examples
Sized enum - HP C Extension
Declarators
Syntax
Description
Pointer Declarators
Array Declarators
Function Declarators
Type Names
Syntax
Description
Examples
Type Definitions Using typedef
Syntax
Description
Example
Initialization
Syntax
Description
Examples
Function Definitions
Syntax
Description
Examples
Four-Byte Extended UNIX Code (EUC)
4 Type Conversions
Integral Promotions
Usual Arithmetic Conversions
Arithmetic Conversions
Integral Conversions
Floating Conversions
Arrays, Pointers, and Functions
5 Expressions and Operators
Arithmetic Operators (+, -, *, /, %)
Syntax
Arguments
Description
Array Subscripting ([ ])
Syntax
Description
Assignment Operators (=, +=, -=, *=, /=, %=,<<=, >>=, &=, ^=, |=)
Syntax
Arguments
Description
Example
Bit Operators (<<, >>, &, ^, |, ~)
Syntax
Arguments
Description
Cast Operator
Syntax
Arguments
Description
Comma Operator (,)
Syntax
Arguments
Description
Conditional Expression Operator (?:)
Syntax
Arguments
Description
Example
Function Calls
Syntax
Description
Increment and Decrement Operators
(++, --)
Syntax
Arguments
Description
Examples
Logical Operators (&&, ||, !)
Syntax
Arguments
Description
Example
Pointer Operators (*, ->, &)
Syntax
Description
Example 1
Relational Operators (>, >=, <, ==, !=)
Syntax
Arguments
Description
Example
sizeof Operator
Syntax
Arguments
Description
Structure and Union Members (., ->)
Syntax
Description
Operator Precedence
Precedence among Operators of Same Class
Operator Quick Reference
Constant Expressions
Integral Expressions
Floating-Point Expressions
lvalue Expressions
Pointer Expressions
Evaluation of Expressions
Examples
Evaluation Order of Subexpressions
6 Statements
Branch Statements
Syntax
Description
Examples
Compound Statement or Block
Syntax
Description
Example
Expression and Null Statements
Syntax
Description
Example
Labeled Statements
Syntax
Description
Example
Looping Statements
Syntax
Description
Examples
Selection Statements
Syntax
Description
Examples
break
Syntax
Description
Example
continue
Syntax
Description
Example
do...while
Syntax
Arguments
Description
Example
for
Syntax
Arguments
Description
Example
goto
Syntax
Arguments
Description
Example
if
Syntax
Arguments
Description
Example
return
Syntax
Arguments
Description
Example
switch
Syntax
Arguments
Description
Example
while
Syntax
Arguments
Description
Example
7 Preprocessing Directives
Overview of the Preprocessor
Source File Inclusion (#include)
Syntax
Description
Examples
Macro Replacement (#define, #undef)
Syntax
Description
Predefined Macros
Conditional Compilation (#if, #ifdef, ..#endif)
Syntax
Description
Examples
Line Control (#line)
Syntax
Description
Example
Pragma Directive (#pragma)
Syntax
Description
Example
Error Directive (#error)
Syntax
Examples
Trigraph Sequences
8 C Library Functions
9 Compiling and Running HP C Programs
Compiling HP C Programs
Compatibility Mode vs. ANSI C Mode
The cc(1) Command
Specifying Files to the cc Command
Specifying Options to the cc Command
HP C Compiler Options
Examples of Compiler Commands
Environment Variables
Compiling for Different Versions of the PA-RISC Architecture
Using +DA to Generate Code for a Specific Version of PA-RISC
Using +DS to Specify Instruction Scheduling
Compiling in Networked Environments
Pragmas
Initialization and Termination Pragmas
Intrinsic Pragmas
Copyright Notice and Identification Pragmas
Data Alignment Pragmas
Listing Pragmas
Optimization Pragmas
Shared Library Pragma
FastCall Pragmas
Running HP C Programs
10 HP C/HP-UX Implementation Topics
Data Types
Bit-Fields
IEEE Floating-Point Format
Lexical Elements
Structures and Unions
Type Mismatches in External Names
Expressions
Pointers
Maximum Number of Dimensions of an Array
Scope of extern Declarations
Conversions Between Floats, Doubles, and Long Doubles
Statements
Preprocessor
Library Functions and Header Files
The Math Library
Other Library Functions
The varargs Macros
Example
C9X standard macros
Variable names
How HP C implements GNU and C9X macros
HP Specific Type Qualifiers
Location of Files
11 Using Intrinsics
INTRINSIC Pragma
Examples
INTRINSIC_FILE Pragma
12 The Listing Facility
Listing Format
Compatibility Mode
ANSI Mode
Listing Pragmas
Listing Options
Identifier Maps
Code Offsets
Example
A Syntax Summary
Lexical Grammar
Tokens
Keywords
Identifiers
Constants
String Literals
Operators
Punctuators
Header Names
Preprocessing Numbers
Phrase Structure Grammar
Expressions
Declarations
Statements
External Definitions
Preprocessing Directives

List of Examples

2-1 Example
© Hewlett-Packard Development Company, L.P.