• Keine Ergebnisse gefunden

Definitions of Terms

Im Dokument III CP·6 (Seite 127-131)

A string is a contiguous sequence of characters terminated by and including the first null character. A "pointer to" a string is a pointer to its initial (lowest addressed) character.

The "length" of a string is the number of characters preceding the null character, and its

"value" is the sequence of the values of the contained characters, in order.

A letter is a printing character in the execution character set corresponding to any of the 52 required lower-case and upper-case letters in the source character set, listed in Section 1.

The decimal-point character is the character used by functions that convert floating-point numbers to or from character sequences to denote the beginning of the fractional part of such character sequences.} It is represented in the text and examples by a period.

Headers

Each library function is declared in a header, whose contents are made available by the

#include preprocessing directive. The header declares a set of related functions, plus any necessary types and additional macros needed to facilitate their use.

1 The functions that make use of the decimal-point character are localeconv, fprintf, fscanf, printf, sCanf, sprintf, sscanf, vfprintf, vprintf, vsprintf, atof, and strtod.

HA17-00 Headers 9-1

Introduction to the C Library one header, the second and subsequent associated headers may be included after the initial reference to the identifier. The program may not have any macros with names lexically identical to keywords currently defined prior to the inclusion.

CP-6 C Headers

These header files provide access to CP-6 specific structures for CP-6 Host functions:

<b$dcb_c.h>

Each header declares or defines all identifiers listed in its associated section, and optionally declares or defines identifiers which are always reserved either for any use or for use as file scope identifiers.

Identifiers are reserved as follows:

9-2 Reserved Identifiers HA17-00

Introduction to the C Library

• All identifiers that begin with an underscore and either an upper-case letter or another underscore are always reserved for any use.

• All identifiers that begin with an underscore are always reserved for use as identifiers with file scope in both the ordinary identifier and tag name spaces.

• Each macro name listed in any of the following sections is reserved for any use if any of its associated headers is included.

• All identifiers with external linkage in any of the following sections are always reserved for use as identifiers with external linkage.2

• Each identifier with file scope listed in any of the following sections is reserved for use as an identifier with file scope in the same name space if any of its associated headers is included.

No other identifiers are reserved. If the program declares or defines an identifier with the same name as an identifier reserved in that context (other than as described under Use of Library Functions later in this section), section), compilation errors (or runtime errors) may result.3

Errors <errno. h>

The header <errno. h> defines several macros, all relating to the reporting of error conditions.

The macros are EDOM ERANGE

which expand to integral constant expressions with distinct nonzero values; and errno

which expands to a modifiable lvalue that has type int, the value of which is set to a positive error number by several library functions. errno is an identifier declared with external linkage. A program should not define an identifier with the name errno.

The value of errno is zero at program startup, but is never set to zero by any library function.4The value of errno may be set to nonzero by a library function call whether or not there is an error.

2 The list of reserved identifiers with external linkage includes errno, setjrnp, and va_end.

3 Since macro names are replaced whenever found, independent of scope and name space, macro names matching any of the reserved identifier names must not be defined if an associated header, if any, is included.

4 Thus, a program that uses errno for error checking should set it to zero before a library function call, then inspect it before a subsequent library function call.

HA17-00 Errors <errno. h> 9-3

Introduction to the C Library

Limits <float. h> and <limits. h>

The headers <float. h> and <limits. h> define several macros that expand to various limits and parameters.

The macros, their meanings, and the constraints (or restrictions) on their values are listed under Numerical Limits, Appendix F.

Common Definitions <stddef. h>

The following types and macros are defined in the standard header <stddef . h>. Some are also defined in other headers, as noted in their respective sections.

The types are

typedef int ptrdiff_tj

which is the signed integral type of the result of subtracting two pointers;

typedef int size_t;

which is the unsigned integral type of the result of the sizeof operator; and typedef char wchar_tj

which is an integral type whose range of values can represent distinct codes for all members of the largest extended character set specified among the- supported locales.

The macros are

#define NULL (void*)O

which expands to a null pointer constant; and off setof (type, member-designator)

which expands to an integral constant expression that has type size_ t, the value of which is the offset in bytes, to the structure member (designated by member-designator), from the beginning of its structure (designated by type). The member-designator is such that gIven

static type t;

then the expression l(t. member-designator) evaluates to an address constant. (The specified member must not be a bit-field.)

9-4 Common Definitions <stddef. h> HA17-00

Introduction to the C Library

Im Dokument III CP·6 (Seite 127-131)