Modular Programming in C

Modular Programming in C

SPARCompilers C2.0.1 Programmer's Guide .SunPro A Sun Microsystems, Inc. Business Sun Microsystems, Inc. 2550 Garcia Avenue Mountain View, CA 94043 U.S.A. Part No: 800-6578-11 Revision A, October 1992 © 1991 by Sun Microsystems, Inc.-Printed in USA. 2550 Garcia Avenue, Mountain View, California 94043-1100 All rights reserved. No part of this work covered by copyright may be reproduced in any form or by any means-graphic, electronic or mechanical, including photocopying, recording, taping, or storage in an information retrieval system-without prior written permission of the copyright owner. The OPEN LOOK and the Sun Graphical User Interfaces were developed by Sun Microsystems, Inc. for its users and licensees. Sun acknowledges the pioneering efforts of Xerox in researching and developing the concept of visual or graphical user interfaces for the computer industry. Sun holds a non-exclusive license from Xerox to the Xerox Graphical User Interface, which license also covers Sun's licensees. RESTRICTED RIGHTS LEGEND: Use, duplication, or disclosure by the government is subject to restrictions as set forth in subparagraph (c)(1)(ii) of the Rights in Technical Data and Computer Software clause at DFARS252.227-7013 (October 1988) and FAR 52.227-19 (June 1987). The product described in this manual may be protected by one or more U.S. patents, foreign patents, and/ or pending applications. TRADEMARKS The Sun logo, Sun Microsystems, Sun Workstation, NeWS, SunPro, and SunLink are registered trademarks of Sun Microsystems, Inc. in the United States and other countries. Sun, Sun-2, Sun-3, Sun-4, Sun386i, SunCD, SunInstall, SunOS, SunView, NFS, and OpenWindows are trademarks of Sun Microsystems, Inc. UNIX and OPEN LOOK are registered trademarks of UNIX System Laboratories, Inc. PostScript is a registered trademark of Adobe Systems Incorporated. Adobe also owns copyrights related to the PostScript language and the PostScript interpreter. The trademark PostScript is used herein only to refer to material supplied by Adobe or to programs written in the PostScript language as defined by Adobe. X Window System is a product of the Massachusetts Institute of Technology. SPARC is a registered trademark ofSPARC International, Inc. Products bearing the SPARC trademark are based on an architecture developed by Sun Microsystems, Inc. SPARCstation is a trademark of SPARC International, Inc., licensed exclusively to Sun Microsystems, Inc. All other products or services mentioned in this document are identified by the trademarks, service marks, or product names as designated by the companies who market those products. Inquiries concerning such trademarks should be made directly to those companies. Portions © AT&T 1983-1990 and reproduced with permission from AT&T. Contents Preface. .. xix Part l-ANSI C Overview 1. Introduction to ANSI C . 1 Operating Environment. 1 C Language. 2 Modular Programming in C ..... ... ... ..... 2 Libraries and Header Files . 3 Creating an Executable ....... 3 C-Related Programming Tools. 4 Program Analysis. 4 Program Management. 5 Program Development... , . .. .. .. .. ... 6 Other Advanced Programming Utilities. 6 2. Compiling and Linking. 9 Compiling and Linking. 9 iii Compiler Command Line Syntax - Basics . 12 How C Programs Communicate with the Shell. .. ... 18 Linking Overview ...... 19 Linking Summary. 22 3. ace Compiler Options for SunOS 4.x. 27 Option Syntax. 27 Options. ... .. .. .. ... .. .. 28 Summary of acc Compiler Options . 42 Commonly Used Command Line Options. 45 Searching for a Header File. 45 Preparing Your Program for Symbolic Debugging . 46 Preparing Your Program for Profiling. 46 N on-Standard Floating Point . 47 4. cc Compiler Options for SunOS 5.0. 49 Option Syntax. 49 Options.. .. ... .. ... 50 Summary of cc Compiler Options. ..... 66 Commonly Used cc Command Line Options . 69 Searching for a Header File. 69 Preparing Your Program for Symbolic Debugging. 70 Preparing Your Program for Profiling. 70 Non-Standard Floating Point. 71 5. The Parts of C .... 73 Introduction. 73 iv SPARCompilers C 2.0 Programmer's Guide-October 1992 Compilation Modes. 73 Global Behavior: Value vs. Unsigned Preserving. 74 How To Use This Chapter..... ... ... .. .. ... 75 Phases of Translation. 75 Source Files and Tokenization. 76 Tokens.. .. .... ..... .. .. .. ... .. ... 76 Identifiers ...................................... 77 Keywords 77 Constants. 77 Wide Characters and Multibyte Characters .......... 80 String Literals ................................... 81 Wide String Literals. 81 Comments. 81 Preprocessing ...................................... 82 Trigraph Sequences . 82 Preprocessing Tokens. 82 Preprocessing Directives. 83 Declarations and Definitions .......................... 92 Introduction. 92 Types .......................................... 92 Scope.......... ............................. ... 95 Storage Class Specifiers. 96 Storage Duration ................................ 97 Declarators . 98 Contents v Function Definitions. .. 101 Conversions and Expressions ......................... 102 Implicit Conversions. .. 102 Expressions ..................................... 105 Operators. .. 106 Asociativity and Precedence of Operators ........... 114 Constant Expressions ............................. 114 Initialization. .. 115 Statements. .. 118 Expression Statement ............................. 118 Compound Statement. .. .. .. .. ... ... .. .. 118 Selection Statements. .. 119 Iteration Statements. .. 120 Jump Statements. .. 122 Portability Considerations. .. 123 6. C Error Messages. 125 Introduction. .. 125 Message Types and Applicable Options. .. 126 Operator Names in Messages.. .. 127 Messages . .. 128 Operator Names. .. .. .. .. .. .. .... 232 Other Error Messages. .. 234 Part 2-C Programming Tools 7. escape Source Code Browser. 239 vi SPARCompilers C 2.0 Programmer's Guide-October 1992 Introduction. .. 239 How escape Works. .. 239 escape - Basic Use. ... .. .. .. .. .. 240 Step 1: Set Up the Environment . .. 240 Step 2: Invoke the escape Program. .. 241 Step 3: Locate the Code. .. 242 Step 4: Edit the Code. .. 249 Command Line Options . .. 250 Using Viewpaths. .. .. .. .. 253 Stacking esc ape and Editor Calls. .. 254 Examples.. ...... .. .. .. .. .. 255 Notes. .. ... .. .. .. .. ... .. .. .. 260 Unknown Terminal Type. .. 260 Command Line Syntax for Editors. .. 261 SourceBrowser. .. 262 8. 1 in t Source Code Checker. 263 Scope of this Chapter. .. 263 Introduction. .. 263 Options and Directives . .. 264 Message Formats . .. 264 What 1 in t Does. .. 265 Consistency Checks . .. 265 Portability Checks. .. 266 Suspicious Constructs . .. 268 Contents vii Usage. ..................................... ........ 269 lint Libraries. .. 271 1 in t Filters. .. 272 Options and Directives Listed. .. 273 lint-specific Messages. .. 278 Part 3-Appendices A. ANSI C Data Representations . ..

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    432 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us