aboutsummaryrefslogtreecommitdiffstats
path: root/doc/info/chap/introduction.texinfo
blob: cb2bfe53be47e4c5af2928927d5a377bb7da9d98 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
@node Introduction
@chapter Introduction

@cpindex Hosted environment
@cpindex Unhosted environment
The C programming language does not provide
any built-in functions or constant values.
It only, provides a few basic numerical
data types. In fact, it does not even call
the function @code{main}. All of these
facilities are provided by the C standard
library. A C environment with a C standard
library is called a hosted environment; one
without it is called an unhosted environment.
Almost all software written in C are written
in hosted C. There are practically only two
types of software not written in an unhosted
environment, the C standard library (commonly
called @command{libc}) implementations
themself, and operating system kernels and
programs started before it.

The Stockholm C Standard Library, or simply
@command{slibc}, described in this document,
is an implementaton of a C standard library for
@sc{POSIX} systems. It is aimed at supporting
@sc{C99} and newer dialects of @sc{ISO}@tie{}C,
and no other programming languages. @command{slibc}
is not aimed to replace an existing @command{libc}
implementation or suiting a particular niche.
Rather, @command{slibc} is intended as a learning
experiences for its developer. It does however,
add extensions (features) that are not defined
by the standards it covers or even existing
@command{libc} implementations.

@command{slibc}'s header files document all
features it implements. This manual is intended
as a more extensive documentation. It is written
with the assumption that you are familiar with
the C programming language.


@menu
* Reserved Names::                            Names you should not use for your functions and variables.
* Feature-Test Macros::                       Specifying features that should be available.
@end menu



@node Reserved Names
@section Reserved Names

The names of all types, variables, functions and
macros, that comes from the @sc{ISO}@tie{}C standard
are reserved. Additionally, all names that are
defined or declared from an explicitly included
header file is reserved.

It is important for maintainability that reserved
names are not redefined. But it is also important
because the C compiler can do special optimisations
bases on the semantics of the standardised function.
It may even replace the function calls, with functions
built into the compiler.

The names that are reserved is not implemented to
those documented in this manual. Some names are
reserved for future use, for the C standard library
to use internally, and for the compiler to define
to give information about the platform. Names
starting with at least one underscore (`_') are
reserved for the two latter. The names that are
reserved for the C and @sc{POSIX} standards, and the
operating system, are:

@itemize @bullet{}
@item
Names that begin with an uppercase @code{E} and
a digit or uppercase letter. These are used for
error-codes names.

@item
Names that begin with @code{LC_} and an uppercase
letter are reserved for locale attributes.

@item
Names that being with @code{SIG} and an uppercase
letter are reserved for signal names.

@item
Names that being with @code{SIG_} and an uppercase
letter are reserved for signal actions.

@item
Names that begin with @code{is} and a lowercase
letter are reserved for character type testing.

@item
Names that begin with @code{mem} and a lowercase
letter are reserved for functions that operate
over character arrays.

@item
Names that begin with @code{str} and a lowercase
letter are reserved for functions that operate
over strings.

@item
Names that begin with @code{to} and a lowercase
letter are reserved for character type conversion.

@item
Names that begin with @code{wmem} and a lowercase
letter are reserved for functions that operate
over wide-character arrays.

@item
Names that begin with @code{wcs} and a lowercase
letter are reserved for functions that operate
over wide-character strings.

@item
Names that end with @code{_t} ae reserved for
type definitions.

@item
Names of existing mathematics functions, suffixed
with @code{f} or @code{l} are reserved for
@code{float}- and @code{long double}-variants
of corresponding functions.

@item
Names that begin with @code{d_} are reserved
for @file{<dirent.h>}.

@item
Names that begin with @code{F_}, @code{O_},
or @code{l_} are reserved for @file{<fcntl.h>}.

@item
Names that begin with @code{gr_} are reserved
for @file{<grp.h>}.

@item
Names that end with @code{_MAX} are reserved
for @file{<limits.h>}.

@item
Names that begin with @code{pw_} are reserved
for @file{<pwd.h>}.

@item
Names that begin with @code{sa_} or @code{SA_}
are reserved for @file{<signal.h>}.

@item
Names that begin with @code{S_} or @code{st_}
are reserved for @file{<sys/stat.h>}.

@item
Names that begin with @code{tms_} are reserved
for @file{<sys/times.h>}.

@item
Names that begin with @code{B} and a digit,
@code{I}, @code{O}, @code{TB}, @code{V}, or
@code{c_} are reserved for @file{<termios.h>}.
@end itemize

It is possible for libraries to avoid restrictions
by prefixing all names with the name of the library
(starting with @code{lib}.) Names that are reserved
for specific header files do not need to considered
unless the header file is included.



@node Feature-Test Macros
@section Feature-Test Macros

LOREM IPSUM