Saving Files

Chapter 5 - C and C++ Programming

Visual C++ 6: The Complete Reference
Chris H. Pappas and William H. Murray, III
  Copyright 1998 The McGraw-Hill Companies

American National Standards Institute—ANSI C
The ANSI (American National Standards Institute) committee has developed standards for the C language. This section describes some of the significant changes suggested and implemented by the committee. Some of these changes are intended to increase the flexibility of the language, others to standardize features previously left to the discretion of the compiler implementor.
Previously, the only standard available was the book The C Programming Language by B. Kernighan and D. Ritchie (Prentice-Hall, Murray Hill, NJ: 1988). This book was not specific on some language details, which led to a divergence among compilers. The ANSI standard strives to remove these ambiguities. Although a few of the proposed changes could cause problems for some previously written programs, they should not affect most.
The ANSI C standard provides an even better opportunity than before to write portable C code. The standard has not corrected all areas of confusion in the language, however, and because C interfaces efficiently with machine hardware, many programs will always require some revision when they are moved to a different environment. The ANSI committee that developed the standard adopted as guidelines some phrases that collectively have been called the “spirit of C.” Some of those phrases are:
  Trust the programmer.
  Don’t prevent the programmer from doing what needs to be done.
  Keep the language small and simple.
Additionally, the international community was consulted to ensure that ANSI (American) standard C would be identical to the ISO (International Standards Organization) standard version. Because of these efforts, C is the only language that effectively deals with alternate collating sequences, enormous character sets, and multiple user cultures. Table 5-1 highlights just some of the areas the ANSI committee addressed.
Table 5-1: ANSI C Recommendations
Feature
Standardized
Data types
(four); character, integer, float point, and enumeration.
Comments
(/*) opening, (*/) closing; proposed —(//) anything to symbol’s right is ignored by the compiler.
Identifier length
31 characters to distinguish uniqueness.
Standard identifiers and header files
An agreed-upon minimum set of identifiers and header files necessary to perform basic operations such as I/O.
Preprocessor statements
The # in preprocessor directives can have leading white space (any combination of spaces and tabs), permitting indented preprocessor directives for clarity. Some earlier compilers insisted that all preprocessor directives begin in column one.
New preprocessor directives
#if defined (expression) #elif (expression)
Adjacent strings
The committee decided that adjacent literal strings should be concatenated. For example, this would allow a #define directive to extend beyond a single line.
Standard libraries
The proposed ANSI standard specifies a basic set of system-level and external routines, such as read( ) and write( ).
Output control
An agreed-upon set of escape codes representing formatting control codes such as newline, new page, and tabs.
Keywords
An agreed-upon minimum set of verbs used to construct valid C statements.
sizeof( )
The committee agreed that the sizeof( ) function should return the type size_t, instead of a possibly system-limiting variable of size integer.
Prototyping
The committee agreed that all C compilers should handle programs that do/do not employ prototyping.
Command line arguments
In order for the C compiler to properly handle command-line arguments, an agreed-upon syntax was defined.
Void pointer type
The void keyword can be applied to functions that do not return a value. A function that does return a value can have its return value cast to void to indicate to the compiler that the value is being deliberately ignored.
Structure handling
Structure handling has been greatly improved. The member names in structure and union definitions need not be unique. Structures can be passed as arguments to functions, returned by functions, and assigned to structures of the same type.
Function declarations
Function declarations can include argument-type lists (function prototyping) to notify the compiler of the number and types of arguments.
Hexadecimal character constants
Hexadecimal character constants can be expressed using an introductory \x followed by from one to three hexadecimal digits (0-9, a-f, A-F). For example, 16 decimal = \x10, which can be written as 0x10 using the current notation.
Trigraphs
Trigraphs define standard symbol sequences that represent those characters that may not be readily available on all keyboards. For example, (??<) can be substituted for the more elaborate ({) symbol.

Books24x7.com, Inc 2000 –  


Visual C++ 6(c) The Complete Reference
Visual Studio 6: The Complete Reference
ISBN: B00007FYGA
EAN: N/A
Year: 1998
Pages: 207

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net