[Previous]
[Contents]
[Next]

Appendix: Implementation-Defined Behavior

This appendix describes the behavior of the 16-bit and 32-bit Watcom C library when the ANSI/ISO C Language standard describes the behavior as implementation-defined. The term describing each behavior is taken directly from the ANSI/ISO C Language standard. The numbers in parentheses at the end of each term refer to the section of the standard that discusses the behavior.

NULL macro

ANSI/ISO: "The null pointer constant to which the macro NULL expands (7.1.6)."

The macro NULL expands to 0 in small data models, and to 0L in large data models.

Diagnostic printed by the assert() function

ANSI/ISO: "The diagnostic printed by and the termination behavior of the assert() function (7.2)."

The assert() function prints a diagnostic message to stderr, and calls the abort() routine if the expression is false. The diagnostic message has the following form:

Assertion failed: [expression], file [name], line [number]

Character testing

ANSI/ISO: " The sets of characters tested for by the isalnum(), isalpha(), iscntrl(), islower(), isprint() and isupper() functions (7.3.1)."

The characters tested are as follows:

isalnum()
Characters 0-9, A-Z, a-z
isalpha()
Characters A-Z, a-z
iscntrl()
ASCII 0x00-0x1f, 0x7f
islower()
Characters a-z
isprint()
ASCII 0x20-0x7e
isupper()
Characters A-Z

Domain errors

ANSI/ISO: "The values returned by the mathematics functions on domain errors (7.5.1)."

When a domain error occurs, the listed values are returned by the following functions:

acos()
0.0
acosh()
-HUGE_VAL
asin()
0.0
atan2()
0.0
atanh()
-HUGE_VAL
log()
-HUGE_VAL
log10()
-HUGE_VAL
log2()
-HUGE_VAL
pow(neg,frac)
0.0
pow(0.0,0.0)
1.0
pow(0.0,neg)
-HUGE_VAL
sqrt()
0.0
y0(), y1(), yn()
-HUGE_VAL

Underflow of floating-point values

ANSI/ISO: "Whether the mathematics functions set the integer expression errno to the value of the macro ERANGE on underflow range errors (7.5.1)."

The integer expression errno isn't set to ERANGE on underflow range errors in the mathematics functions.

fmod()

ANSI/ISO: "Whether a domain error occurs or zero is returned when the fmod() function has a second argument of zero (7.5.6.4)."

Zero is returned when the second argument to fmod() is zero.

signal()

ANSI/ISO: "The set of signals for the signal() function (7.7.1.1)."

ANSI/ISO: "The semantics for each signal recognized by the signal() function (7.7.1.1)."

ANSI/ISO: "The default handling and the handling at program startup for each signal recognized by the signal() function (7.7.1.1)."

See the description of the signal() function presented earlier in this reference. Also see the QNX System Architecture manual.

Default signals

ANSI/ISO: "If the equivalent of signal ( sig, SIG_DFL ); is not executed prior to the call of a signal handler, the blocking of the signal that is performed (7.7.1.1)."

The equivalent of

signal( sig, SIG_DFL );

is executed prior to the call of a signal handler.

The SIGILL signal

ANSI/ISO: "Whether the default handling is reset if the SIGILL signal is received by a handler specified to the signal() function (7.7.1.1)."

The equivalent of

signal( SIGILL, SIG_DFL );

is executed prior to the call of the signal handler.

Terminating newline characters

ANSI/ISO: "Whether the last line of a text stream requires a terminating newline character (7.9.2)."

The last line of a text stream doesn't require a terminating newline character.

Space characters

ANSI/ISO: "Whether space characters that are written out to a text stream immediately before a newline character appear when read in (7.9.2)."

All characters written out to a text stream will appear when read in.

Null characters

ANSI/ISO: "The number of null characters that may be appended to data written to a binary stream (7.9.2)."

No null characters are appended to data written to a binary stream.

File position in append mode

ANSI/ISO: "Whether the file position indicator of an append mode stream is initially positioned at the beginning or end of the file (7.9.3)."

When a file is open in append mode, the file position indicator initially points to the end of the file.

Truncation of text files

ANSI/ISO: "Whether a write on a text stream causes the associated file to be truncated beyond that point (7.9.3)."

Writing to a text stream doesn't truncate the file beyond that point.

File buffering

ANSI/ISO: "The characteristics of file buffering (7.9.3)."

Disk files accessed through the standard I/O functions are fully buffered. The default buffer size is 1024 bytes.

Zero-length files

ANSI/ISO: "Whether a zero-length file actually exists (7.9.3)."

A file with length zero can exist.

File names

ANSI/ISO: "The rules of composing valid file names (7.9.3)."

A valid file specification consists of an optional node name (which is always preceded by two slashes), a series of optional directory names (each preceded by one slash), and a file name. If a node name or directory name precedes the file name, the file name must also be preceded by a slash.

Directory names and file names can contain up to 48 characters. Case is respected.

File access limits

ANSI/ISO: "Whether the same file can be open multiple times (7.9.3)."

It is possible to open a file multiple times.

Deleting open files

ANSI/ISO: "The effect of the remove() function on an open file (7.9.4.1)."

The remove() function deletes a file, even if the file is open.

Renaming with a name that exists

ANSI/ISO: "The effect if a file with the new name exists prior to a call to the rename() function (7.9.4.2)."

The rename() function succeeds if you attempt to rename a file using a name that exists.

Printing pointer values

ANSI/ISO: "The output for %p conversion in the fprintf() function (7.9.6.1)."

Two types of pointers are supported: near pointers (%hp), and far pointers (%lp). The output for %p depends on the memory model being used.

In 16-bit mode, the fprintf() function produces hexadecimal values of the form XXXX for 16-bit near pointers, and XXXX:XXXX (segment and offset separated by a colon) for 32-bit far pointers.

In 32-bit mode, the fprintf() function produces hexadecimal values of the form XXXXXXXX for 32-bit near pointers, and XXXX:XXXXXXXX (segment and offset separated by a colon) for 48-bit far pointers.

Reading pointer values

ANSI/ISO: "The input for %p conversion in the fscanf() function (7.9.6.2)."

The fscanf() function converts hexadecimal values into the correct address when the %p format specifier is used.

Reading ranges

ANSI/ISO: "The interpretation of a - character that is neither the first nor the last character in the scanlist for %[ conversion in the fscanf() function (7.9.6.2)."

The "-" character indicates a character range. The character prior to the "-" is the first character in the range. The character following the "-" is the last character in the range.

File position errors

ANSI/ISO: "The value to which the macro errno is set by the fgetpos() or ftell() function on failure (7.9.9.1, 7.9.9.4)."

When the functions fgetpos() and ftell() fail, they set errno to EBADF if the file number is bad. The constants are defined in the <errno.h> header file.

Messages generated by perror()

ANSI/ISO: "The messages generated by the perror() function (7.9.10.4)."

The perror() function generates the following messages:

0
"No error"
1
"Operation not permitted"
2
"No such file or directory"
3
"No such process"
4
"Interrupted function call"
5
"I/O error"
6
"No such device or address"
7
"Arg list too big"
8
"Exec format error"
9
"Bad file descriptor"
10
"No child processes"
11
"Resource unavailable; try again"
12
"Not enough memory"
13
"Permission denied"
14
"Bad address"
15
"Block device required"
16
"Resource busy"
17
"File exists"
18
"Improper link"
19
"No such device"
20
"Not a directory"
21
"Is a directory"
22
"Invalid argument"
23
"Too many files in the system"
24
"Too many open files"
25
"Inappropriate I/O control operation"
26
"Text file busy"
27
"File too large"
28
"No space left on device"
29
"Invalid seek"
30
"Read-only file system"
31
"Too many links"
32
"Broken pipe"
33
"Math arg out of domain of func"
34
"Result too large"
35
"No message of desired type"
36
"Identifier removed"
37
"Channel number out of range"
38
"Level 2 not synchronized"
39
"Level 3 halted"
40
"Level 3 reset"
41
"Link number out of range"
42
"Protocol driver not attached"
43
"No CSI structure available"
44
"Level 2 halted"
45
"Resource deadlock avoided"
46
"No locks available"
62
"Too many levels of symbolic links or prefixes"
78
"Filename too long"
83
"Can't access shared library"
84
"Accessing a corrupted shared lib"
85
".lib section in a.out corrupted"
86
"Attempting to link in too many libs"
87
"Attempting to exec a shared lib"
89
"Function not implemented"
93
"Directory not empty"
103
"Operation not supported"
122
"Potentially recoverable I/O error"
1000
"Must be done on local machine"
1001
"Need an NDP (8087...) to run"
1002
"Corrupted file system detected"
1003
"32 bit integer fields were used"
1004
"no proc entry avail for virtual process"
1005
"process manager-to-net enqueuing failed"
1006
"could not find net manager for node no."
1007
"told to allocate a vid buf too small"
1008
"told to allocate a vid buf too big"
1009
"More to do; send message again"
1010
"Remap to controlling terminal"
1011
"No license"

Allocating zero memory

ANSI/ISO: "The behavior of the calloc(), malloc() or realloc() function if the size requested is zero (7.10.3)."

The value returned is NULL. No actual memory is allocated.

abort()

ANSI/ISO: "The behavior of the abort() function with regard to open and temporary files (7.10.4.1)."

The abort() function doesn't close any files that are open or temporary, nor does it flush any output buffers.

atexit()

ANSI/ISO: "The status returned by the exit() function if the value of the argument is other than zero, EXIT_SUCCESS, or EXIT_FAILURE (7.10.4.3)."

The exit() function returns the value of its argument to the operating system, regardless of its value.

Environment names

ANSI/ISO: "The set of environment names and the method for altering the environment list used by the getenv() function (7.10.4.4)."

The set of environment names is unlimited. Environment variables can be set from the QNX command line using the export or set shell commands, or the env utility. A program can modify its environment variables with the putenv() function. Such modifications last only until the program terminates.

system()

ANSI/ISO: "The contents and mode of execution of the string by the system() function (7.10.4.5)."

The system() function always executes an executable binary or a shell file, using /bin/sh.

strerror()

ANSI/ISO: "The contents of the error message strings returned by the strerror() function (7.11.6.2)."

The strerror() function generates the following messages:

0
"No error"
1
"Operation not permitted"
2
"No such file or directory"
3
"No such process"
4
"Interrupted function call"
5
"I/O error"
6
"No such device or address"
7
"Arg list too big"
8
"Exec format error"
9
"Bad file descriptor"
10
"No child processes"
11
"Resource unavailable; try again"
12
"Not enough memory"
13
"Permission denied"
14
"Bad address"
15
"Block device required"
16
"Resource busy"
17
"File exists"
18
"Improper link"
19
"No such device"
20
"Not a directory"
21
"Is a directory"
22
"Invalid argument"
23
"Too many files in the system"
24
"Too many open files"
25
"Inappropriate I/O control operation"
26
"Text file busy"
27
"File too large"
28
"No space left on device"
29
"Invalid seek"
30
"Read-only file system"
31
"Too many links"
32
"Broken pipe"
33
"Math arg out of domain of func"
34
"Result too large"
35
"No message of desired type"
36
"Identifier removed"
37
"Channel number out of range"
38
"Level 2 not synchronized"
39
"Level 3 halted"
40
"Level 3 reset"
41
"Link number out of range"
42
"Protocol driver not attached"
43
"No CSI structure available"
44
"Level 2 halted"
45
"Resource deadlock avoided"
46
"No locks available"
62
"Too many levels of symbolic links or prefixes"
78
"Filename too long"
83
"Can't access shared library"
84
"Accessing a corrupted shared lib"
85
".lib section in a.out corrupted"
86
"Attempting to link in too many libs"
87
"Attempting to exec a shared lib"
89
"Function not implemented"
93
"Directory not empty"
103
"Operation not supported"
122
"Potentially recoverable I/O error"
1000
"Must be done on local machine"
1001
"Need an NDP (8087...) to run"
1002
"Corrupted file system detected"
1003
"32 bit integer fields were used"
1004
"no proc entry avail for virtual process"
1005
"process manager-to-net enqueuing failed"
1006
"could not find net manager for node no."
1007
"told to allocate a vid buf too small"
1008
"told to allocate a vid buf too big"
1009
"More to do; send message again"
1010
"Remap to controlling terminal"
1011
"No license"

Time zone

ANSI/ISO: "The local time zone and Daylight Saving Time (7.12.1)."

The time zone is set in the system initialization file for your node (for example, /etc/config/sysinit.2). See the QNX User's Guide.

clock()

ANSI/ISO: "The era for the clock() function (7.12.2.1)."

The clock() function's era begins with a value of 0 when the program starts to execute.


[Previous]
[Contents]
[Next]