HomeContentsPreviousNextIndex

C User's Guide Sun Microsystems

Contents

 Preface

1.  Introduction to the C Compiler

Standards Conformance
Organization of the Compiler
C-Related Programming Tools

2.  cc Compiler Options

Option Syntax
Options Summary
The cc Options
-#
-###
-Aname[(tokens)]
-B[static|dynamic]
-C
-c
-Dname[=tokens]
-d[y|n]
-dalign
-E
-erroff=t
-errtags=a
-errwarn=t
-fast
-fd
-flags
-fnonstd
-fns[={no,yes}]
-fprecision=p
-fround=r
-fsimple[=n]
-fsingle
-fstore
-ftrap=t
-G
-g
-H
-h name
-Idir
-i
-KPIC
-Kpic
-keeptmp
-Ldir
-lname
-mc
-misalign
-misalign2
-mr
-mr,string
-mt
-native
-nofstore
-noqueue
-O
-o filename
-P
-p
-Q[y|n]
-qp
-Rdir[:dir]
-S
-s
-Uname
-V
-v
-Wc,arg
-w
-X[a|c|s|t]
-x386
-x486
-xa
-xarch=isa
-xautopar
-xCC
-xcache=c
-xcg[89|92]
-xchar_byte_order=o
-xchip=c
-xcode=v
-xcrossfile=[n]
-xdepend
-xe
-xexplicitpar
-xF
-xhelp=f
-xildoff
-xildon
-xinline=[{%auto,func_name,no%func_name}[,{%auto,func_name,no%func_name}]...]
-xlibmieee
-xlibmil
-xlic_lib=sunperf
-xlicinfo
-xloopinfo
-xM
-xM1
-xMerge
-xmaxopt=off, 1, 2, 3, 4, 5
-xmemalign=ab
-xnolib
-xnolibmil
-xO[1|2|3|4|5]
-xP
-xparallel
-xpentium
-xpg
-xprefetch=[val],val
-xprofile=p
-xreduction
-xregs=r
-xrestrict=f
-xs
-xsafe=mem
-xsb
-xsbfast
-xsfpconst
-xspace
-xstrconst
-xtarget=t
-xtemp=dir
-xtime
-xtransition
-xunroll=n
-xvector[={yes|no}
-xvpara
-Yc, dir
-YA, dir
-YI, dir
-YP, dir
-YS, dir
-Zll
-Zlp
Options Passed to the Linker

3.  Sun ANSI/ISO C Compiler-Specific Information

Environment Variables
TMPDIR
SUNPRO_SB_INIT_FILE_NAME
PARALLEL
SUNW_MP_THR_IDLE
Global Behavior: Value Versus unsigned Preserving
Keywords
asm Keyword
_Restrict Keyword
long long Data Type
Printing long long Data Types
Usual Arithmetic Conversions
Constants
Integral Constants
Character Constants
Include Files
Nonstandard Floating Point
Preprocessing Directives and Names
Assertions
Pragmas
Variable Argument Lists for #define
Predefined Data
Predefined Names

4.  Parallelizing Sun ANSI/ISO C Code

Overview
Environment Variables
Data Dependence and Interference
Parallel Execution Model
Private Scalars and Private Arrays
Storeback
Reduction Variables
Speedups
Amdahl's Law
Load Balance and Loop Scheduling
Static or Chunk Scheduling
Self Scheduling
Guided Self Scheduling
Loop Transformations
Loop Distribution
Loop Fusion
Loop Interchange
Aliasing and Parallelization
Array and Pointer References
Restricted Pointers
Explicit Parallelization and Pragmas
Compiler Options

5.  Incremental Link Editor (ild)

Introduction
Overview of Incremental Linking
How to Use ild
How ild Works
What ild Cannot Do
Reasons for Full Relinks
ild Deferred-Link Messages
ild Relink Messages
Example 1: internal free space exhausted
Example 2: running strip
Example 3: ild version
Example 4: too many files changed
Example 5: full relink
Example 6: new working directory
ild Options
-a
-B dynamic | static
-d y|n
-e epsym
-g
-I name
-i
-Lpath
-lx
-m
-o outfile
-Q y|n
-Rpath
-s
-t
-u symname
-V
-xildoff
-xildon
-YP,dirlist
-z allextract|defaultextract| weakextract
-z defs
-z i_dryrun
-z i_full
-z i_noincr
-z i_quiet
-z i_verbose
-z nodefs
Options Passed to ild from the Compilation System
-a
-m
-t
-e epsym
-I name
-u symname
Environment
Notes
ld Options Not Supported by ild
-B symbolic
-b
-G
-h name
-z muldefs
-z text
Additional Unsupported Commands
-D token,token, ...
-F name
-M mapfile
-r
Files That ild Uses

6.  lint Source Code Checker

Basic and Enhanced lint Modes
Using lint
The lint Options
-#
-###
-a
-b
-C filename
-c
-dirout=dir
-err=warn
-errchk=l(, l)
-errfmt=f
-errhdr=h
-erroff=tag(, tag)
-errtags=a
-errwarn=t
-F
-fd
-flagsrc=file
-h
-Idir
-k
-Ldir
-lx
-m
-Ncheck=c
-Nlevel=n
-n
-ox
-p
-Rfile
-s
-u
-V
-v
-Wfile
-x
-XCC=a
-Xarch=v9
-Xexplicitpar=a
-Xkeeptmp=a
-Xtemp=dir
-Xtime=a
-Xtransition=a
-y
lint Messages
Options to Suppress Messages
lint Message Formats
lint Directives
Predefined Values
Directives
lint Reference and Examples
Checks Performed by lint
lint Libraries
lint Filters

7.  Transitioning to ANSI/ISO C

Basic Modes
-Xa
-Xc
-Xs
-Xt
A Mixture of Old- and New-Style Functions
Writing New Code
Updating Existing Code
Mixing Considerations
Functions with Varying Arguments
Promotions: Unsigned Versus Value Preserving
Background
Compilation Behavior
First Example: The Use of a Cast
Bit-fields
Second Example: Same Result
Integral Constants
Third Example: Integral Constants
Tokenization and Preprocessing
ANSI/ISO C Translation Phases
Old C Translation Phases
Logical Source Lines
Macro Replacement
Using Strings
Token Pasting
const and volatile
Types, Only for lvalue
Type Qualifiers in Derived Types
const Means readonly
Examples of const Usage
volatile Means Exact Semantics
Examples of volatile Usage
Multibyte Characters and Wide Characters
Asian Languages Require 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
Internationalization
Locales
The setlocale() Function
Changed Functions
New Functions
Grouping and Evaluation in Expressions
Definitions
The K&R C Rearrangement License
The ANSI/ISO C Rules
The Parentheses
The As If Rule
Incomplete Types
Types
Completing Incomplete Types
Declarations
Expressions
Justification
Examples
Compatible and Composite Types
Multiple Declarations
Separate Compilation Compatibility
Single Compilation Compatibility
Compatible Pointer Types
Compatible Array Types
Compatible Function Types
Special Cases
Composite Types

8.  Converting Applications

Overview of the Data Model Differences
Implementing Single Source Code
Derived Types
Tools
Converting to the LP64 Data Type Model
Integer and Pointer Size Change
Integer and Long Size Change
Sign Extension
Pointer Arithmetic Instead of Address Arithmetic
Structures
Unions
Type Constants
Beware of Implicit Declarations
sizeof( ) is an Unsigned Long
Use Casts to Show Your Intentions
Check Format String Conversion Operation
Other Considerations
Derived Types That Have Grown in Size
Check for Side Effects of Changes
Check Whether Literal Uses of long Still Make Sense
Use #ifdef for Explicit 32-bit Versus 64-bit Prototypes
Calling Convention Changes
Algorithm Changes
Checklist for Getting Started

9.  cscope: Interactively Examining a C Program

The cscope Process
Basic Use
Step 1: Set Up the Environment
Step 2: Invoke the cscope Program
Step 3: Locate the Code
Step 4: Edit the Code
Command-Line Options
View Paths
cscope and Editor Call Stacks
Examples
Command-Line Syntax for Editors
Unknown Terminal Type Error

A.  ANSI/ISO C Data Representations

Storage Allocation
Data Representations
Integer Representations
Floating-Point Representations
Exceptional Values
Hexadecimal Representation of Selected Numbers
Pointer Representation
Array Storage
Arithmetic Operations on Exceptional Values
Argument-Passing Mechanism

B.  Implementation-Defined Behavior

Implementation Compared to the ANSI/ISO Standard
Translation (G.3.1)
Environment (G.3.2)
Identifiers (G.3.3)
Characters(G.3.4)
Integers(G.3.5)
Floating-Point(G.3.6)
Arrays and Pointers(G.3.7)
Registers(G.3.8)
Structures, Unions, Enumerations, and Bit-Fields(G.3.9)
Qualifiers(G.3.10)
Declarators(G.3.11)
Statements(G.3.12)
Preprocessing Directives(G.3.13)
Library Functions(G.3.14)
Locale-Specific Behavior(G.4)

C.  Performance Tuning (SPARC)

Limits
libfast.a Library

D.  The Differences Between K&R Sun C and Sun ANSI/ISO C

K&R Sun C Incompatibilities with Sun ANSI/ISO C
The Difference Between Sun C and ANSI/ISO C As Set By -Xs
Keywords

 Index


Sun Microsystems, Inc.
Copyright information. All rights reserved.
Feedback
Library   |   Contents   |   Previous   |   Next   |   Index