1C99(1P) POSIX Programmer's Manual C99(1P)
2
3
4
6 This manual page is part of the POSIX Programmer's Manual. The Linux
7 implementation of this interface may differ (consult the corresponding
8 Linux manual page for details of Linux behavior), or the interface may
9 not be implemented on Linux.
10
12 c99 — compile standard C programs
13
15 c99 [options...] pathname [[pathname] [-I directory]
16 [-L directory] [-l library]]...
17
19 The c99 utility is an interface to the standard C compilation system;
20 it shall accept source code conforming to the ISO C standard. The sys‐
21 tem conceptually consists of a compiler and link editor. The input
22 files referenced by pathname operands and -l option-arguments shall be
23 compiled and linked to produce an executable file. (It is unspecified
24 whether the linking occurs entirely within the operation of c99; some
25 implementations may produce objects that are not fully resolved until
26 the file is executed.)
27
28 If the -c option is specified, for all pathname operands of the form
29 file.c, the files:
30
31
32 $(basename pathname .c).o
33
34 shall be created as the result of successful compilation. If the -c
35 option is not specified, it is unspecified whether such .o files are
36 created or deleted for the file.c operands.
37
38 If there are no options that prevent link editing (such as -c or -E),
39 and all input files compile and link without error, the resulting exe‐
40 cutable file shall be written according to the -o outfile option (if
41 present) or to the file a.out.
42
43 The executable file shall be created as specified in Section 1.1.1.4,
44 File Read, Write, and Creation, except that the file permission bits
45 shall be set to: S_IRWXO | S_IRWXG | S_IRWXU
46
47 and the bits specified by the umask of the process shall be cleared.
48
50 The c99 utility shall conform to the Base Definitions volume of
51 POSIX.1‐2017, Section 12.2, Utility Syntax Guidelines, except that:
52
53 * Options can be interspersed with operands.
54
55 * The order of specifying the -L and -l options, and the order of
56 specifying -l options with respect to pathname operands is signifi‐
57 cant.
58
59 * Conforming applications shall specify each option separately; that
60 is, grouping option letters (for example, -cO) need not be recog‐
61 nized by all implementations.
62
63 The following options shall be supported:
64
65 -c Suppress the link-edit phase of the compilation, and do not
66 remove any object files that are produced.
67
68 -D name[=value]
69 Define name as if by a C-language #define directive. If no
70 =value is given, a value of 1 shall be used. The -D option
71 has lower precedence than the -U option. That is, if name is
72 used in both a -U and a -D option, name shall be undefined
73 regardless of the order of the options. Additional implemen‐
74 tation-defined names may be provided by the compiler. Imple‐
75 mentations shall support at least 2048 bytes of -D defini‐
76 tions and 256 names.
77
78 -E Copy C-language source files to standard output, executing
79 all preprocessor directives; no compilation shall be per‐
80 formed. If any operand is not a text file, the effects are
81 unspecified.
82
83 -g Produce symbolic information in the object or executable
84 files; the nature of this information is unspecified, and may
85 be modified by implementation-defined interactions with other
86 options.
87
88 -I directory
89 Change the algorithm for searching for headers whose names
90 are not absolute pathnames to look in the directory named by
91 the directory pathname before looking in the usual places.
92 Thus, headers whose names are enclosed in double-quotes ("")
93 shall be searched for first in the directory of the file with
94 the #include line, then in directories named in -I options,
95 and last in the usual places. For headers whose names are
96 enclosed in angle brackets ("<>"), the header shall be
97 searched for only in directories named in -I options and then
98 in the usual places. Directories named in -I options shall be
99 searched in the order specified. If the -I option is used to
100 specify a directory that is one of the usual places searched
101 by default, the results are unspecified. Implementations
102 shall support at least ten instances of this option in a sin‐
103 gle c99 command invocation.
104
105 -L directory
106 Change the algorithm of searching for the libraries named in
107 the -l objects to look in the directory named by the direc‐
108 tory pathname before looking in the usual places. Directories
109 named in -L options shall be searched in the order specified.
110 If the -L option is used to specify a directory that is one
111 of the usual places searched by default, the results are
112 unspecified. Implementations shall support at least ten
113 instances of this option in a single c99 command invocation.
114 If a directory specified by a -L option contains files with
115 names starting with any of the strings "libc.", "libl.",
116 "libpthread.", "libm.", "librt.", "libtrace.", "libxnet.", or
117 "liby.", the results are unspecified.
118
119 -l library
120 Search the library named liblibrary.a. A library shall be
121 searched when its name is encountered, so the placement of a
122 -l option is significant. Several standard libraries can be
123 specified in this manner, as described in the EXTENDED
124 DESCRIPTION section. Implementations may recognize implemen‐
125 tation-defined suffixes other than .a as denoting libraries.
126
127 -O optlevel
128 Specify the level of code optimization. If the optlevel
129 option-argument is the digit '0', all special code optimiza‐
130 tions shall be disabled. If it is the digit '1', the nature
131 of the optimization is unspecified. If the -O option is omit‐
132 ted, the nature of the system's default optimization is
133 unspecified. It is unspecified whether code generated in the
134 presence of the -O 0 option is the same as that generated
135 when -O is omitted. Other optlevel values may be supported.
136
137 -o outfile
138 Use the pathname outfile, instead of the default a.out, for
139 the executable file produced. If the -o option is present
140 with -c or -E, the result is unspecified.
141
142 -s Produce object or executable files, or both, from which sym‐
143 bolic and other information not required for proper execution
144 using the exec family defined in the System Interfaces volume
145 of POSIX.1‐2017 has been removed (stripped). If both -g and
146 -s options are present, the action taken is unspecified.
147
148 -U name Remove any initial definition of name.
149
150 Multiple instances of the -D, -I, -L, -l, and -U options can be speci‐
151 fied.
152
154 The application shall ensure that at least one pathname operand is
155 specified. The following forms for pathname operands shall be sup‐
156 ported:
157
158 file.c A C-language source file to be compiled and optionally
159 linked. The application shall ensure that the operand is of
160 this form if the -c option is used.
161
162 file.a A library of object files typically produced by the ar util‐
163 ity, and passed directly to the link editor. Implementations
164 may recognize implementation-defined suffixes other than .a
165 as denoting object file libraries.
166
167 file.o An object file produced by c99 -c and passed directly to the
168 link editor. Implementations may recognize implementation-
169 defined suffixes other than .o as denoting object files.
170
171 The processing of other files is implementation-defined.
172
174 Not used.
175
177 Each input file shall be one of the following: a text file containing a
178 C-language source program, an object file in the format produced by c99
179 -c, or a library of object files, in the format produced by archiving
180 zero or more object files, using ar. Implementations may supply addi‐
181 tional utilities that produce files in these formats. Additional input
182 file formats are implementation-defined.
183
185 The following environment variables shall affect the execution of c99:
186
187 LANG Provide a default value for the internationalization vari‐
188 ables that are unset or null. (See the Base Definitions vol‐
189 ume of POSIX.1‐2017, Section 8.2, Internationalization Vari‐
190 ables for the precedence of internationalization variables
191 used to determine the values of locale categories.)
192
193 LC_ALL If set to a non-empty string value, override the values of
194 all the other internationalization variables.
195
196 LC_CTYPE Determine the locale for the interpretation of sequences of
197 bytes of text data as characters (for example, single-byte as
198 opposed to multi-byte characters in arguments and input
199 files).
200
201 LC_MESSAGES
202 Determine the locale that should be used to affect the format
203 and contents of diagnostic messages written to standard
204 error.
205
206 NLSPATH Determine the location of message catalogs for the processing
207 of LC_MESSAGES.
208
209 TMPDIR Provide a pathname that should override the default directory
210 for temporary files, if any. On XSI-conforming systems, pro‐
211 vide a pathname that shall override the default directory for
212 temporary files, if any.
213
215 Default.
216
218 If more than one pathname operand ending in .c (or possibly other
219 unspecified suffixes) is given, for each such file:
220
221
222 "%s:\n", <pathname>
223
224 may be written. These messages, if written, shall precede the process‐
225 ing of each input file; they shall not be written to the standard out‐
226 put if they are written to the standard error, as described in the
227 STDERR section.
228
229 If the -E option is specified, the standard output shall be a text file
230 that represents the results of the preprocessing stage of the language;
231 it may contain extra information appropriate for subsequent compilation
232 passes.
233
235 The standard error shall be used only for diagnostic messages. If more
236 than one pathname operand ending in .c (or possibly other unspecified
237 suffixes) is given, for each such file:
238
239
240 "%s:\n", <pathname>
241
242 may be written to allow identification of the diagnostic and warning
243 messages with the appropriate input file. These messages, if written,
244 shall precede the processing of each input file; they shall not be
245 written to the standard error if they are written to the standard out‐
246 put, as described in the STDOUT section.
247
248 This utility may produce warning messages about certain conditions that
249 do not warrant returning an error (non-zero) exit value.
250
252 Object files or executable files or both are produced in unspecified
253 formats. If the pathname of an object file or executable file to be
254 created by c99 resolves to an existing directory entry for a file that
255 is not a regular file, it is unspecified whether c99 shall attempt to
256 create the file or shall issue a diagnostic and exit with a non-zero
257 exit status.
258
260 Standard Libraries
261 The c99 utility shall recognize the following -l options for standard
262 libraries:
263
264 -l c This option shall make available all interfaces referenced in
265 the System Interfaces volume of POSIX.1‐2017, with the possi‐
266 ble exception of those interfaces listed as residing in
267 <aio.h>, <arpa/inet.h>, <complex.h>, <fenv.h>, <math.h>,
268 <mqueue.h>, <netdb.h>, <net/if.h>, <netinet/in.h>,
269 <pthread.h>, <sched.h>, <semaphore.h>, <spawn.h>,
270 <sys/socket.h>, pthread_kill(), and pthread_sigmask() in
271 <signal.h>, <trace.h>, interfaces marked as optional in
272 <sys/mman.h>, interfaces marked as ADV (Advisory Information)
273 in <fcntl.h>, and interfaces beginning with the prefix clock_
274 or timer_ in <time.h>. This option shall not be required to
275 be present to cause a search of this library.
276
277 -l l This option shall make available all interfaces required by
278 the C-language output of lex that are not made available
279 through the -l c option.
280
281 -l pthread
282 This option shall make available all interfaces referenced in
283 <pthread.h> and pthread_kill() and pthread_sigmask() refer‐
284 enced in <signal.h>. An implementation may search this
285 library in the absence of this option.
286
287 -l m This option shall make available all interfaces referenced in
288 <math.h>, <complex.h>, and <fenv.h>. An implementation may
289 search this library in the absence of this option.
290
291 -l rt This option shall make available all interfaces referenced in
292 <aio.h>, <mqueue.h>, <sched.h>, <semaphore.h>, and <spawn.h>,
293 interfaces marked as optional in <sys/mman.h>, interfaces
294 marked as ADV (Advisory Information) in <fcntl.h>, and inter‐
295 faces beginning with the prefix clock_ and timer_ in
296 <time.h>. An implementation may search this library in the
297 absence of this option.
298
299 -l trace This option shall make available all interfaces referenced in
300 <trace.h>. An implementation may search this library in the
301 absence of this option.
302
303 -l xnet This option shall make available all interfaces referenced in
304 <arpa/inet.h>, <netdb.h>, <net/if.h>, <netinet/in.h>, and
305 <sys/socket.h>. An implementation may search this library in
306 the absence of this option.
307
308 -l y This option shall make available all interfaces required by
309 the C-language output of yacc that are not made available
310 through the -l c option.
311
312 In the absence of options that inhibit invocation of the link editor,
313 such as -c or -E, the c99 utility shall cause the equivalent of a -l c
314 option to be passed to the link editor after the last pathname operand
315 or -l option, causing it to be searched after all other object files
316 and libraries are loaded.
317
318 It is unspecified whether the libraries libc.a, libl.a, libm.a,
319 libpthread.a, librt.a, libtrace.a, libxnet.a, or liby.a exist as regu‐
320 lar files. The implementation may accept as -l option-arguments names
321 of objects that do not exist as regular files.
322
323 External Symbols
324 The C compiler and link editor shall support the significance of exter‐
325 nal symbols up to a length of at least 31 bytes; the action taken upon
326 encountering symbols exceeding the implementation-defined maximum sym‐
327 bol length is unspecified.
328
329 The compiler and link editor shall support a minimum of 511 external
330 symbols per source or object file, and a minimum of 4095 external sym‐
331 bols in total. A diagnostic message shall be written to the standard
332 output if the implementation-defined limit is exceeded; other actions
333 are unspecified.
334
335 Header Search
336 If a file with the same name as one of the standard headers defined in
337 the Base Definitions volume of POSIX.1‐2017, Chapter 13, Headers, not
338 provided as part of the implementation, is placed in any of the usual
339 places that are searched by default for headers, the results are
340 unspecified.
341
342 Programming Environments
343 All implementations shall support one of the following programming
344 environments as a default. Implementations may support more than one of
345 the following programming environments. Applications can use sysconf()
346 or getconf to determine which programming environments are supported.
347
348 Table 4-4: Programming Environments: Type Sizes
349
350 ┌────────────────────────┬─────────┬─────────┬─────────┬─────────┐
351 │Programming Environment │ Bits in │ Bits in │ Bits in │ Bits in │
352 │ getconf Name │ int │ long │ pointer │ off_t │
353 ├────────────────────────┼─────────┼─────────┼─────────┼─────────┤
354 │_POSIX_V7_ILP32_OFF32 │ 32 │ 32 │ 32 │ 32 │
355 │_POSIX_V7_ILP32_OFFBIG │ 32 │ 32 │ 32 │ ≥64 │
356 │_POSIX_V7_LP64_OFF64 │ 32 │ 64 │ 64 │ 64 │
357 │_POSIX_V7_LPBIG_OFFBIG │ ≥32 │ ≥64 │ ≥64 │ ≥64 │
358 └────────────────────────┴─────────┴─────────┴─────────┴─────────┘
359 All implementations shall support one or more environments where the
360 widths of the following types are no greater than the width of type
361 long:
362
363 blksize_t ptrdiff_t tcflag_t
364 cc_t size_t wchar_t
365 mode_t speed_t wint_t
366 nfds_t ssize_t
367 pid_t suseconds_t
368
369 The executable files created when these environments are selected shall
370 be in a proper format for execution by the exec family of functions.
371 Each environment may be one of the ones in Table 4-4, Programming Envi‐
372 ronments: Type Sizes, or it may be another environment. The names for
373 the environments that meet this requirement shall be output by a get‐
374 conf command using the POSIX_V7_WIDTH_RESTRICTED_ENVS argument, as a
375 <newline>-separated list of names suitable for use with the getconf -v
376 option. If more than one environment meets the requirement, the names
377 of all such environments shall be output on separate lines. Any of
378 these names can then be used in a subsequent getconf command to obtain
379 the flags specific to that environment with the following suffixes
380 added as appropriate:
381
382 _CFLAGS To get the C compiler flags.
383
384 _LDFLAGS To get the linker/loader flags.
385
386 _LIBS To get the libraries.
387
388 This requirement may be removed in a future version.
389
390 When this utility processes a file containing a function called main(),
391 it shall be defined with a return type equivalent to int. Using return
392 from the initial call to main() shall be equivalent (other than with
393 respect to language scope issues) to calling exit() with the returned
394 value. Reaching the end of the initial call to main() shall be equiva‐
395 lent to calling exit(0). The implementation shall not declare a proto‐
396 type for this function.
397
398 Implementations provide configuration strings for C compiler flags,
399 linker/loader flags, and libraries for each supported environment.
400 When an application needs to use a specific programming environment
401 rather than the implementation default programming environment while
402 compiling, the application shall first verify that the implementation
403 supports the desired environment. If the desired programming environ‐
404 ment is supported, the application shall then invoke c99 with the
405 appropriate C compiler flags as the first options for the compile, the
406 appropriate linker/loader flags after any other options except -l but
407 before any operands or -l options, and the appropriate libraries at the
408 end of the operands and -l options.
409
410 Conforming applications shall not attempt to link together object files
411 compiled for different programming models. Applications shall also be
412 aware that binary data placed in shared memory or in files might not be
413 recognized by applications built for other programming models.
414
415 Table 4-5: Programming Environments: c99 Arguments
416
417 ┌────────────────────────┬─────────────────────┬───────────────────────────────┐
418 │Programming Environment │ │ c99 Arguments │
419 │ getconf Name │ Use │ getconf Name │
420 ├────────────────────────┼─────────────────────┼───────────────────────────────┤
421 │_POSIX_V7_ILP32_OFF32 │ C Compiler Flags │ POSIX_V7_ILP32_OFF32_CFLAGS │
422 │ │ Linker/Loader Flags │ POSIX_V7_ILP32_OFF32_LDFLAGS │
423 │ │ Libraries │ POSIX_V7_ILP32_OFF32_LIBS │
424 ├────────────────────────┼─────────────────────┼───────────────────────────────┤
425 │_POSIX_V7_ILP32_OFFBIG │ C Compiler Flags │ POSIX_V7_ILP32_OFFBIG_CFLAGS │
426 │ │ Linker/Loader Flags │ POSIX_V7_ILP32_OFFBIG_LDFLAGS │
427 │ │ Libraries │ POSIX_V7_ILP32_OFFBIG_LIBS │
428 ├────────────────────────┼─────────────────────┼───────────────────────────────┤
429 │_POSIX_V7_LP64_OFF64 │ C Compiler Flags │ POSIX_V7_LP64_OFF64_CFLAGS │
430 │ │ Linker/Loader Flags │ POSIX_V7_LP64_OFF64_LDFLAGS │
431 │ │ Libraries │ POSIX_V7_LP64_OFF64_LIBS │
432 ├────────────────────────┼─────────────────────┼───────────────────────────────┤
433 │_POSIX_V7_LPBIG_OFFBIG │ C Compiler Flags │ POSIX_V7_LPBIG_OFFBIG_CFLAGS │
434 │ │ Linker/Loader Flags │ POSIX_V7_LPBIG_OFFBIG_LDFLAGS │
435 │ │ Libraries │ POSIX_V7_LPBIG_OFFBIG_LIBS │
436 └────────────────────────┴─────────────────────┴───────────────────────────────┘
437 In addition to the type size programming environments above, all imple‐
438 mentations also support a multi-threaded programming environment that
439 is orthogonal to all of the programming environments listed above. The
440 getconf utility can be used to get flags for the threaded programming
441 environment, as indicated in Table 4-6, Threaded Programming Environ‐
442 ment: c99 Arguments.
443
444 Table 4-6: Threaded Programming Environment: c99 Arguments
445
446 ┌────────────────────────┬─────────────────────┬──────────────────────────┐
447 │Programming Environment │ │ c99 Arguments │
448 │ getconf Name │ Use │ getconf Name │
449 ├────────────────────────┼─────────────────────┼──────────────────────────┤
450 │_POSIX_THREADS │ C Compiler Flags │ POSIX_V7_THREADS_CFLAGS │
451 │ │ Linker/Loader Flags │ POSIX_V7_THREADS_LDFLAGS │
452 └────────────────────────┴─────────────────────┴──────────────────────────┘
453 These programming environment flags may be used in conjunction with any
454 of the type size programming environments supported by the implementa‐
455 tion.
456
458 The following exit values shall be returned:
459
460 0 Successful compilation or link edit.
461
462 >0 An error occurred.
463
465 When c99 encounters a compilation error that causes an object file not
466 to be created, it shall write a diagnostic to standard error and con‐
467 tinue to compile other source code operands, but it shall not perform
468 the link phase and it shall return a non-zero exit status. If the link
469 edit is unsuccessful, a diagnostic message shall be written to standard
470 error and c99 exits with a non-zero status. A conforming application
471 shall rely on the exit status of c99, rather than on the existence or
472 mode of the executable file.
473
474 The following sections are informative.
475
477 Since the c99 utility usually creates files in the current directory
478 during the compilation process, it is typically necessary to run the
479 c99 utility in a directory in which a file can be created.
480
481 On systems providing POSIX Conformance (see the Base Definitions volume
482 of POSIX.1‐2017, Chapter 2, Conformance), c99 is required only with the
483 C-Language Development option; XSI-conformant systems always provide
484 c99.
485
486 Some historical implementations have created .o files when -c is not
487 specified and more than one source file is given. Since this area is
488 left unspecified, the application cannot rely on .o files being cre‐
489 ated, but it also must be prepared for any related .o files that
490 already exist being deleted at the completion of the link edit.
491
492 There is the possible implication that if a user supplies versions of
493 the standard functions (before they would be encountered by an implicit
494 -l c or explicit -l m), that those versions would be used in place of
495 the standard versions. There are various reasons this might not be
496 true (functions defined as macros, manipulations for clean name space,
497 and so on), so the existence of files named in the same manner as the
498 standard libraries within the -L directories is explicitly stated to
499 produce unspecified behavior.
500
501 All of the functions specified in the System Interfaces volume of
502 POSIX.1‐2017 may be made visible by implementations when the Standard C
503 Library is searched. Conforming applications must explicitly request
504 searching the other standard libraries when functions made visible by
505 those libraries are used.
506
507 In the ISO C standard the mapping from physical source characters to
508 the C source character set is implementation-defined. Implementations
509 may strip white-space characters before the terminating <newline> of a
510 (physical) line as part of this mapping and, as a consequence of this,
511 one or more white-space characters (and no other characters) between a
512 <backslash> character and the <newline> character that terminates the
513 line produces implementation-defined results. Portable applications
514 should not use such constructs.
515
516 Some c99 compilers not conforming to POSIX.1‐2008 do not support tri‐
517 graphs by default.
518
520 1. The following usage example compiles foo.c and creates the exe‐
521 cutable file foo:
522
523
524 c99 -o foo foo.c
525
526 The following usage example compiles foo.c and creates the object
527 file foo.o:
528
529
530 c99 -c foo.c
531
532 The following usage example compiles foo.c and creates the exe‐
533 cutable file a.out:
534
535
536 c99 foo.c
537
538 The following usage example compiles foo.c, links it with bar.o,
539 and creates the executable file a.out. It may also create and
540 leave foo.o:
541
542
543 c99 foo.c bar.o
544
545 2. The following example shows how an application using threads inter‐
546 faces can test for support of and use a programming environment
547 supporting 32-bit int, long, and pointer types and an off_t type
548 using at least 64 bits:
549
550
551 offbig_env=$(getconf _POSIX_V7_ILP32_OFFBIG)
552 if [ $offbig_env != "-1" ] && [ $offbig_env != "undefined" ]
553 then
554 c99 $(getconf POSIX_V7_ILP32_OFFBIG_CFLAGS) \
555 $(getconf POSIX_V7_THREADS_CFLAGS) -D_XOPEN_SOURCE=700 \
556 $(getconf POSIX_V7_ILP32_OFFBIG_LDFLAGS) \
557 $(getconf POSIX_V7_THREADS_LDFLAGS) foo.c -o foo \
558 $(getconf POSIX_V7_ILP32_OFFBIG_LIBS) \
559 -l pthread
560 else
561 echo ILP32_OFFBIG programming environment not supported
562 exit 1
563 fi
564
565 3. The following examples clarify the use and interactions of -L and
566 -l options.
567
568 Consider the case in which module a.c calls function f() in library
569 libQ.a, and module b.c calls function g() in library libp.a.
570 Assume that both libraries reside in /a/b/c. The command line to
571 compile and link in the desired way is:
572
573
574 c99 -L /a/b/c main.o a.c -l Q b.c -l p
575
576 In this case the -L option need only precede the first -l option,
577 since both libQ.a and libp.a reside in the same directory.
578
579 Multiple -L options can be used when library name collisions occur.
580 Building on the previous example, suppose that the user wants to
581 use a new libp.a, in /a/a/a, but still wants f() from
582 /a/b/c/libQ.a:
583
584
585 c99 -L /a/a/a -L /a/b/c main.o a.c -l Q b.c -l p
586
587 In this example, the linker searches the -L options in the order
588 specified, and finds /a/a/a/libp.a before /a/b/c/libp.a when
589 resolving references for b.c. The order of the -l options is still
590 important, however.
591
592 4. The following example shows how an application can use a program‐
593 ming environment where the widths of the following types: blk‐
594 size_t, cc_t, mode_t, nfds_t, pid_t, ptrdiff_t, size_t, speed_t,
595 ssize_t, suseconds_t, tcflag_t, wchar_t, wint_t
596
597 are no greater than the width of type long:
598
599
600 # First choose one of the listed environments ...
601
602 # ... if there are no additional constraints, the first one will do:
603 CENV=$(getconf POSIX_V7_WIDTH_RESTRICTED_ENVS | head -n l)
604
605 # ... or, if an environment that supports large files is preferred,
606 # look for names that contain "OFF64" or "OFFBIG". (This chooses
607 # the last one in the list if none match.)
608 for CENV in $(getconf POSIX_V7_WIDTH_RESTRICTED_ENVS)
609 do
610 case $CENV in
611 *OFF64*|*OFFBIG*) break ;;
612 esac
613 done
614
615 # The chosen environment name can now be used like this:
616
617 c99 $(getconf ${CENV}_CFLAGS) -D _POSIX_C_SOURCE=200809L \
618 $(getconf ${CENV}_LDFLAGS) foo.c -o foo \
619 $(getconf ${CENV}_LIBS)
620
622 The c99 utility is based on the c89 utility originally introduced in
623 the ISO POSIX‐2:1993 standard.
624
625 Some of the changes from c89 include the ability to intersperse options
626 and operands (which many c89 implementations allowed despite it not
627 being specified), the description of -l as an option instead of an op‐
628 erand, and the modification to the contents of the Standard Libraries
629 section to account for new headers and options; for example, <spawn.h>
630 added to the description of -l rt, and -l trace added for the Tracing
631 option.
632
633 POSIX.1‐2008 specifies that the c99 utility must be able to use regular
634 files for *.o files and for a.out files. Implementations are free to
635 overwrite existing files of other types when attempting to create
636 object files and executable files, but are not required to do so. If
637 something other than a regular file is specified and using it fails for
638 any reason, c99 is required to issue a diagnostic message and exit with
639 a non-zero exit status. But for some file types, the problem may not be
640 noticed for a long time. For example, if a FIFO named a.out exists in
641 the current directory, c99 may attempt to open a.out and will hang in
642 the open() call until another process opens the FIFO for reading. Then
643 c99 may write most of the a.out to the FIFO and fail when it tries to
644 seek back close to the start of the file to insert a timestamp (FIFOs
645 are not seekable files). The c99 utility is also allowed to issue a
646 diagnostic immediately if it encounters an a.out or *.o file that is
647 not a regular file. For portable use, applications should ensure that
648 any a.out, -o option-argument, or *.o files corresponding to any *.c
649 files do not conflict with names already in use that are not regular
650 files or symbolic links that point to regular files.
651
652 On many systems, multi-threaded applications run in a programming envi‐
653 ronment that is distinct from that used by single-threaded applica‐
654 tions. This multi-threaded programming environment (in addition to
655 needing to specify -l pthread at link time) may require additional
656 flags to be set when headers are processed at compile time (-D_REEN‐
657 TRANT being common). This programming environment is orthogonal to the
658 type size programming environments discussed above and listed in Table
659 4-4, Programming Environments: Type Sizes. This version of the stan‐
660 dard adds getconf utility calls to provide the C compiler flags and
661 linker/loader flags needed to support multi-threaded applications. Note
662 that on a system where single-threaded applications are a special case
663 of a multi-threaded application, both of these getconf calls may return
664 NULL strings; on other implementations both of these strings may be
665 non-NULL strings.
666
667 The C standardization committee invented trigraphs (e.g., "??!" to rep‐
668 resent '|') to address character portability problems in development
669 environments based on national variants of the 7-bit ISO/IEC 646:1991
670 standard character set. However, these environments were already obso‐
671 lete by the time the first ISO C standard was published, and in prac‐
672 tice trigraphs have not been used for their intended purpose, and usu‐
673 ally are intended to have their original meaning in K&R C. For exam‐
674 ple, in practice a C-language source string like "What??!" is usually
675 intended to end in two <question-mark> characters and an <exclamation-
676 mark>, not in '|'.
677
678 When the -E option is used, execution of some #pragma preprocessor
679 directives may simply result in a copy of the directive being included
680 in the output as part of the allowed extra information used by subse‐
681 quent compilation passes (see STDOUT).
682
684 Unlike all of the other non-OB-shaded utilities in this standard, a
685 utility by this name probably will not appear in the next version of
686 this standard. This utility's name is tied to the current revision of
687 the ISO C standard at the time this standard is approved. Since the
688 ISO C standard and this standard are maintained by different organiza‐
689 tions on different schedules, we cannot predict what the compiler will
690 be named in the next version of the standard.
691
693 Section 1.1.1.4, File Read, Write, and Creation, ar, getconf, make, nm,
694 strip, umask
695
696 The Base Definitions volume of POSIX.1‐2017, Chapter 8, Environment
697 Variables, Section 12.2, Utility Syntax Guidelines, Chapter 13, Headers
698
699 The System Interfaces volume of POSIX.1‐2017, exec, sysconf()
700
702 Portions of this text are reprinted and reproduced in electronic form
703 from IEEE Std 1003.1-2017, Standard for Information Technology -- Por‐
704 table Operating System Interface (POSIX), The Open Group Base Specifi‐
705 cations Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of
706 Electrical and Electronics Engineers, Inc and The Open Group. In the
707 event of any discrepancy between this version and the original IEEE and
708 The Open Group Standard, the original IEEE and The Open Group Standard
709 is the referee document. The original Standard can be obtained online
710 at http://www.opengroup.org/unix/online.html .
711
712 Any typographical or formatting errors that appear in this page are
713 most likely to have been introduced during the conversion of the source
714 files to man page format. To report such errors, see https://www.ker‐
715 nel.org/doc/man-pages/reporting_bugs.html .
716
717
718
719IEEE/The Open Group 2017 C99(1P)