Sun WorkShop Compiler C 5.0 User's Guide

Preface

This manual describes the Sun WorkShop 5.0 C programming language compiler along with ANSI C compiler-specific information. This manual also describes the cscope process and the lint program that you can use to examine your code. In the back of this manual, there are several appendices with reference material such as ANSI C data representations, implementation defined behavior, the differences between Sun C (K & R) and Sun ANSI C, performance tuning, transitioning to ANSI C, and converting applications to compile for the 64-bit environment.

Who Should Use This Book

This manual is intended for programmers with a working knowledge of C and some understanding of the Solaris(TM) operating environment and UNIX\256 commands.

How This Book Is Organized

Chapter 1, "Introduction to the C Compiler," provides information about the C compiler, including operating environments, standards conformance, organization of the compiler, and C-related programming tools.

Chapter 2, "cc Compiler Options," describes the C compiler options. It includes sections on option syntax, the cc options, and options passed to the linker.

Chapter 3, "Sun ANSI/ISO C Compiler-Specific Information," documents those areas specific to the Sun ANSI C compiler.

Chapter 4, "cscope:Interactively Examining a C Program," is a tutorial for the cscope browser which is provided with this release.

Chapter 5, "lint Source Code Checker," describes the lint program, its modes, options, messages, directives, and other helpful information.

Appendix A, "ANSI/ISO C Data Representations," describes how ANSI C represents data in storage and the mechanisms for passing arguments to functions.

Appendix B, "Implementation-Defined Behavior," describes the implementation-defined features of the Sun WorkShop C compiler.

Appendix C, "-Xs Differences Between Sun C and ANSI/ISO C," describes the differences in compiler behavior when you distinguish between Sun C and Sun ANSI C.

Appendix D, "Performance Tuning (SPARC)," describes performance tuning on SPARC platforms.

Appendix E, "Transitioning to ANSI/ISO C," provides tips and strategies for writing ANSI C compliant code.

Appendix F, "Converting Applications," provides the information you need to write code for the 32 bit or the 64-bit compilation environment.

Appendix G, "K&R Sun C / Sun ANSI/ISO C Differences," describes the differences between the previous K&R Sun C and Sun ANSI C.

Multiplatform Release


Note -

The name of the latest Solaris operating environment release is Solaris 7 but code and path or package path names may use Solaris 2.7 or SunOS 5.7.


The Sun(TM) WorkShop(TM) documentation applies to Solaris 2.5.1, Solaris 2.6, and Solaris 7 operating environments on:

Related Books

Other Sun WorkShop Books

Solaris Books

The following Solaris manuals and guides provide additional useful information:

Ordering Sun Documents

The SunDocsSM program provides more than 250 manuals from Sun Microsystems, Inc. If you live in the United States, Canada, Europe, or Japan, you can purchase documentation sets or individual manuals using this program.

For a list of documents and how to order them, see the catalog section of the SunExpress(TM) Internet site at http://www.sun.com/sunexpress.

Accessing Sun Documents Online

Sun WorkShop documentation is available online from several sources:

Using the docs.sun.com Web site

The docs.sun.com Web site enables you to access Sun technical documentation online. You can browse the docs.sun.com archive or search for a specific book title or subject. The URL is http://docs.sun.com.

Accessing AnswerBook2 Collections

The Sun WorkShop documentation is also available using AnswerBook2 software. To access the AnswerBook2 collections, your system administrator must have installed the AnswerBook2 documents during the installation process (if the documents are not installed, see your system administrator or Chapter 3 of Sun WorkShop Quick Install for installation instructions). For information about accessing AnswerBook2 documents, see Chapter 6 of Sun WorkShop Quick Install, Solaris installation documentation, or your system administrator.


Note -

To access AnswerBook2 documents, Solaris 2.5.1 users must first download AnswerBook2 documentation server software from a Sun Web page. For more information, see Chapter 6 of Sun WorkShop Quick Install.


Accessing HTML Documents

The following Sun Workshop documents are available online only in HTML format:

To access these HTML documents:

  1. Open the following file through your HTML browser:

    install-directory/SUNWspro/DOC5.0/lib/locale/C/html/index.html

    Replace install-directory with the name of the directory where your Sun WorkShop software is installed (the default is /opt).

    The browser displays an index of the HTML documents for the Sun WorkShop products that are installed.

  2. Open a document in the index by clicking the document's title.

Accessing Sun WorkShop Online Help and Release Notes

This release of Sun WorkShop includes an online help system as well as online manuals. To find out more see:

What Typographic Changes Mean

The following table describes the typographic changes used in this book.

Table P-1 Typographic Conventions

Typeface or Symbol 

Meaning 

Example 

AaBbCc123

The names of commands, files, and directories; on-screen computer output 

Edit your .login file.

Use ls -a to list all files.

machine_name% You have mail.

 

AaBbCc123

What you type, contrasted with on-screen computer output 

machine_name% su

Password:

AaBbCc123

Command-line placeholder: 

replace with a real name or value 

To delete a file, type rm filename.

AaBbCc123

Book titles, new words or terms, or words to be emphasized 

Read Chapter 6 in User's Guide. These are called class options.

You must be root to do this.

Shell Prompts in Command Examples

The following table shows the default system prompt and superuser prompt for the C shell, Bourne shell, and Korn shell.

Table P-2 System Prompts

Shell 

Prompt 

C shell prompt 

machine_name%

C shell superuser prompt 

machine_name#

Bourne shell and Korn shell prompt 

$

Bourne shell and Korn shell superuser prompt 

#