digitalmars.com                      
Last update Sat Jun 18 16:54:31 2011

Constants

This chapter describes constants (defined names) and their values.

The values of defined names in this chapter are provided for reference only; they may change in future releases. They are especially valuable when debugging, when the name might not be available.

_access Mode Values

Declared in: io.h
Name Value Meaning

_bios_disk Service Values

Declared in: bios.h
Name Value Meaning
_DISK_RESET 0 Hard reset
_DISK_STATUS 1 Retrieve status
_DISK_READ 2 Read sectors
_DISK_WRITE 3 Write sectors
_DISK_VERIFY 4 Verify disk readability
_DISK_FORMAT 5 Format track

_bios_keybrd Service Values

Declared in: bios.h
Name Value Meaning
_KEYBRD_READ 0x00 Keyboard read
_KEYBRD_READY 0x01 Is keystroke available?
_KEYBRD_SHIFTSTATUS 0x02 Retrieve shift key status
_NKEYBRD_READ 0x10 Enhanced read
_NKEYBRD_READY 0x11 Enhanced ready
_NKEYBRD_SHIFTSTATUS 0x12 Enhanced shift status

_bios_printer Service Values

Declared in: bios.h
Name Value Meaning
_PRINTER_WRITE 0 Write data to printer
_PRINTER_INIT 1 Initialize printer
_PRINTER_STATUS 2 Retrieve printer status

_bios_serialcom Service Values

Declared in: bios.h
Name Value Meaning
_COM_INIT 0 Initialize port
_COM_SEND 1 Send data
_COM_RECEIVE 2 Receive data
_COM_STATUS 3 Request status

_bios_serialcom Data Values

Declared in: bios.h
Name Value Meaning
_COM_110 0x00 110 baud
_COM_NOPARITY 0x00 No parity
_COM_STOP1 0x00 1 stop bit
_COM_CHR7 ` 0x02 7 data bits
_COM_CHR8 0x03 8 data bits
_COM_STOP2 0x04 2 stop bits
_COM_ODDPARITY 0x08 Odd parity
_COM_EVENPARITY 0x18 Even parity
_COM_150 0x20 150 baud
_COM_300 0x40 300 baud
_COM_600 0x60 600 baud
_COM_1200 0x80 1200 baud
_COM_2400 0xa0 2400 baud
_COM_4800 0xc0 4800 baud
_COM_9600 0xe0 9600 baud

_bios_timeofday Service Values

Declared in: bios.h
Name Value Meaning
_TIME_GETCLOCK 0 Retrieve time
_TIME_SETCLOCK 1 Set time

clock Values

Declared in: time.h

To convert from ticks to seconds, divide the clock_t value returned from the clock function by CLOCKS_PER_SEC.

Name Value Meaning
CLOCKS_PER_SEC 100 Number of timer ticks per second
CLK_TCK 100 Synonym of CLOCKS_PER_SEC

cpumode Values

Declared in: stdlib.h
Name Value Meaning
_REAL_MODE 0 Running in real mode
_PROT_MODE 1 Running in protected mode

disp_setattr Display Attribute Values

Declared in: disp.h
Name Value Meaning
DISP_NONDISPLAY 0x00 Non-displaying attribute
DISP_UNDERLINE 0x01 Underline attribute
DISP_NORMAL 0x07 Normal attribute
DISP_INTENSITY 0x08 Intensity attribute
DISP-REVERSEVIDEO 0x70 Reverse video attribute
DISP_BLINK 0x80 Blink attribute

disp_setcursortype Standard Cursor Types

Declared in: disp.h

For monochrome/ color values:

Name Value Meaning
DISP_CURSORBLOCK 0x000c/0x0007 Block cursor
DISP_CURSORHALF 0x060c/0x0307 Half cursor
DISP_CURSORUL 0x0b0c/0x0707 Underline cursor

EMM Page Size

Declared in: emm.h
EMM_PAGESIZE, 0x4000, Size of an EMM page
Name Value Meaning

errno Values

Declared in: errno.h and other header files
Name Value Meaning
EZERO 0 No error
EPERM 1 Operation not permitted
ENOENT 2 No such file or directory
ESRCH 3 No such process
EINTR 4 Interrupted function call
EIO 5 Input/ output error
ENXIO 6 No such device or address
E2BIG 7 Argument list too long
ENOEXEC 8 Exec format error
EBADF 9 Bad file descriptor
ECHILD 10 No child processes
EAGAIN 11 Resource temporarily unavailable
ENOMEM 12 Not enough space
EACCES 13 Permission denied
EFAULT 14 Bad address
EBUSY 16 Resource device
EEXIST 17 File exists
EXDEV 18 Improper link
ENODEV 19 No such device
ENOTDIR 20 Not a directory
EISDIR 21 Is a directory
EINVAL 22 Invalid argument
ENFILE 23 Too many open files in system
EMFILE 24 Too many open files
ENOTTY 25 Inappropriate I/ O control operation
EFBIG 27 File too large
ENOSPC 28 No space left on device
ESPIPE 29 Invalid seek
EROFS 30 Read-only file system
EMLINK 31 Too many links
EPIPE 32 Broken pipe
EDOM 33 Domain error
ERANGE 34 Result too large
EDEADLK 36 Resource deadlock avoided
EDEADLOCK 36 Synonym of EDEADLK
ENAMETOOLONG 38 Filename too long
ENOLCK 39 No locks available
ENOSYS 40 Function not implemented
ENOTEMPTY 41 Directory not empty
EILSEQ 42 Illegal byte sequence

exit ANSI-Standard Return Values

Declared in: stdlib.h
Name Value Meaning
EXIT_SUCCESS 0 Successful termination
EXIT_FAILURE 1 Unsuccessful termination

File Attributes

Declared in: dos.h

Several functions,, including _dos_creat and _dos_findfirst, use these attributes. Note that some values, which can be used when searching, cannot be used when creating a file. Examples are _A_VOLID and _A_SUBDIR: a volume ID or a subdirectory cannot be created with _dos_creat, only a file can be created.

Name Value Meaning
_A_NORMAL 0x00 Normal file
_A_RDONLY 0x01 Read-only file
_A_HIDDEN 0x02 Hidden file
_A_SYSTEM 0x04 System file
_A_VOLID 0x08 Volume ID
_A_SUBDIR 0x10 Subdirectory
_A_ARCH 0x20 File changed since last archive
FA_NORMAL 0x00 Synonym of _A_NORMAL
FA_RDONLY 0x01 Synonym of _A_RDONLY
FA_HIDDEN 0x02 Synonym of _A_HIDDEN
FA_SYSTEM 0x04 Synonym of _A_SYSTEM
FA_LABEL 0x08 Synonym of _A_VOLID
FA_DIREC 0x10 Synonym of _A_SUBDIR
FA_ARCH 0x20 Synonym of _A_ARCH

Floating-Point Number Classifications

Declared in: fltpnt.h
Name Value Meaning
FP_NANS 0 Signaling NaN
FP_NANQ 1 Quiet NaN
FP_INFINITE 2 Infinity
FP_NORMAL 3 Any number not covered by other classifications
FP_SUBNORMAL 4 Subnormal or denormal
FP_ZERO 5 Zero

Floating-Point Exceptions

Declared in: fltenv.h
Name Value Meaning
FE_INVALID 0x01 Invalid operand or operation
FE_DIVBYZERO 0x04 Divide by zero
FE_OVERFLOW 0x08 Overflow
FE_UNDERFLOW 0x10 Underflow
FE_INEXACT 0x20 Inexact result
FE_ALL_EXCEPT 0x3F All exceptions

Floating-Point Precision Values

Declared in: fltenv.h
Name Value Meaning
FE_FLTPREC 0x0000 Use float (32-bit) precision
FE_DBLPREC 0x0200 Use double (64-bit) precision
FE_LDBLPREC 0x0300 Use long double (80-bit) precision

Floating-Point Rounding Values

Declared in: fltenv.h
Name Value Meaning
FE_TONEAREST 0x0000 Round to nearest value
FE_DOWNWARD 0x0400 Round toward negative infinity
FE_UPWARD 0x0800 Round toward positive infinity
FE_TOWARDZERO 0x0c00 Round toward zero (drop fractional part)

Floating-Point Special Values

Declared in: fltenv.h
Name Meaning
INFINITY The value of positive infinity
NAN The value of a quiet NaN
NANS The value of a signaling NaN

Floating-Point Characteristic Constants

Declared in: float.h
Name Value Meaning
DBL_MIN_EXP -1021 Smallest exponent value for a double, using base FLT_RADIX
LDBL_MIN_EXP -1021 Smallest exponent value for a long double, using base FLT_RADIX
DBL_DIG 15 Number of decimal digits accurately represented by a double
DBL_EPSILON 2.2204460492501131e-16 Smallest difference between two doubles
DBL_MANT_DIG 53 Number of base-FLT_RADIX digits in the significand of a double (number of binary digits in the significand)
DBL_MAX 1.7976931348623157e+308 Largest positive value represented by a double
DBL_MAX_10_EXP 308 Largest exponent for a double, using base 10
DBL_MAX_EXP 1024 Largest exponent value for a double, using base FLT_RADIX
DBL_MIN 2.225073855072014e-308 Smallest positive value represented by a double
DBL_MIN_10_EXP -307 Smallest exponent for a double, using base 10
FLT_DIG 6 Number of decimal digitals represented by a float
FLT_EPSILON 1.1920929e-7f Smallest difference between two floats
FLT_MANT_DIG 24 Number of base FLT_RADIX digits in significand of float (number of binary digits in significand)
FLT_MAX 3.402823466e+38F Largest positive value represented by a float
FLT_MAX_10_EXP 38 Largest exponent value for a float, using base 10
FLT_MAX_EXP 128 Largest exponent value for a float, using base FLT_RADIX
FLT_MIN 1.175494351e-38 Smallest positive value represented by a float
FLT_MIN_10_EXP -37 Smallest exponent value for a float, using base 10
FLT_MIN_EXP -125 Smallest exponent value for a float, using base FLT_RADIX
FLT_RADIX 2 Radix used to represent floating point numbers
LDBL_DIG 15 Number of decimal digits represented by a long double
LDBL_EPSILON 2.2204460492501131e-16 Smallest difference between two long doubles
LDBL_MANT_DIG 53 Number of base FLT_RADIX digits in significand of a long double (number of binary digits in significand)
LDBL_MAX 1.7976931348623157e+308 Largest positive value represented by a long double
LDBL_MAX_10_EXP 308 Largest exponent value for a long double, using base 10
LDBL_MAX_EXP 1024 Largest exponent value for a long double, using base FLT_RADIX
LDBL_MIN 2.2250738585072014e-308 Smallest positive value represented by a long double
LDBL_MIN_10_EXP -307 Smallest exponent value for a long double, using base 10

fnsplit Return Values

Declared in: dir.h
Name Value Meaning
EXTENSION 0x02 An extension was found
FILENAME 0x04 A filename was found
DIRECTORY 0x08 A directory was found
DRIVE 0x10 A drive was found

fnsplit Maximum Size of Components

Declared in: dir.h
Name Value Meaning
MAXDRIVE 3 Largest drive identifier
MAXEXT 5 Largest extension
MAXFILE 6 Largest filename
MAXDIR 66 Largest directory name
MAXPATH 80 Largest pathname

_getch and _getche Extended Key Codes

Declared in: conio.h

To return a key with no ASCII value, such as a function key, _getch returns a 0 or 0xe0 followed by one of these codes:

Name Value Meaning
_KB_BACK_TAB 15 Backtab
_KB_F1 59 F1
_KB_F2 60 F2
_KB_F3 61 F3
_KB_F4 62 F4
_KB_F5 63 F5
_KB_F6 64 F6
_KB_F7 65 F7
_KB_F8 66 F8
_KB_F9 67 F9
_KB_F10 68 F10
_KB_HOME 71 Home
_KB_UP 72 Up arrow
_KB_PGUP 73 Page up
_KB_LEFT 75 Left arrow
_KB_RIGHT 77 Right arrow
_KB_END 79 End
_KB_DOWN 80 Down arrow
_KB_PGDN 81 Page down
_KB_INS 82 Insert
_KB_DEL 83 Delete
_KB_SF1 84 Shift-F1
_KB_SF2 85 Shift-F2
_KB_SF3 86 Shift-F3
_KB_SF4 87 Shift-F4
_KB_SF5 88 Shift-F5
_KB_SF6 89 Shift-F6
_KB_SF7 90 Shift-F7
_KB_SF8 91 Shift-F8
_KB_SF9 92 Shift-F9
_KB_SF10 93 Shift-F10
_KB_CF1 94 Control-F1
_KB_CF2 95 Control-F2
_KB_CF3 96 Control-F3
_KB_CF4 97 Control-F4
_KB_CF5 98 Control-F5
_KB_CF6 99 Control-F6
_KB_CF7 100 Control-F7
_KB_CF8 101 Control-F8
_KB_CF9 102 Control-F9
_KB_CF10 103 Control-F10
_KB_AF1 104 Alt-F1
_KB_AF2 105 Alt-F2
_KB_AF3 106 Alt-F3
_KB_AF4 107 Alt-F4
_KB_AF5 108 Alt-F5
_KB_AF6 109 Alt-F6
_KB_AF7 110 Alt-F7
_KB_AF8 111 Alt-F8
_KB_AF9 112 Alt-F9
_KB_AF10 113 Alt-F10
_KB_CLEFT 115 Control-left arrow
_KB_CRIGHT 116 Control-right arrow
_KB_CEND 117 Control-end
_KB_CPGDN 118 Control-page down
_KB_CHOME 119 Control-home
_KB_A1 120 Alt-1
_KB_A2 121 Alt-2
_KB_A3 122 Alt-3
_KB_A4 123 Alt-4
_KB_A5 124 Alt-5
_KB_A6 125 Alt-6
_KB_A7 126 Alt-7
_KB_A8 127 Alt-8
_KB_A9 128 Alt-9
_KB_A0 129 Alt-0
_KB_AMINUS 130 Alt-minus
_KB_APLUS 131 Alt-plus
_KB_CPGUP 132 Control-page up

_hardresume Result Codes

Declared in: dos.h
Name Value Meaning
_HARDERR_IGNORE 0 Ignore error
_HARDERR_RETRY 1 Retry operation
_HARDERR_ABORT 2 Abort program
_HARDERR_FAIL 3 Fail system call

HUGE_VAL

Declared in: math.h
Name Value Meaning
HUGE_VAL infinity Double value represents overflow

Integer Sizes

Declared in: limits.h
Name Value Meaning
CHAR_BIT 8 Number of bits in char
CHAR_MAX 255 or 127 Largest char, depends on sign
CHAR_MIN 0 or -127 Smallest char, depends on sign
INT_MAX 2147483647 or 32767 Largest int, depends on size
INT_MIN -2147483647 or -32767 Smallest int, depends on size
LONG_MAX 2147483647 Largest long
LONG_MIN -2147483647 Smallest long
MB_LEN_MAX 2 Longest multi-byte char
SCHAR_MAX 127 Largest signed char
SCHAR_MIN -127 Smallest signed char
SHRT_MAX 32767 Largest short
SHRT_MIN -32767 Smallest short
UCHAR_MAX 255 Largest unsigned char
UINT_MAX 65535 or 4294967295 Largest unsigned int, depends on size
USHRT_MAX 65535 Largest unsigned short

_locking Mode Values

Declared in: sys\locking.h
Name Value Meaning
_LK_UNLCK 0 Unlock
_LK_LOCK 1 Lock with retry
_LK_NBLCK 2 Lock without retry
_LK_RLCK 3 Same as _LK_LOCK
_LK_NBRLCK 4 Same as _LK_NBLCK
LK_UNLCK 0 Synonym of _LK_UNLCK
LK_LOCK 1 Synonym of _LK_LOCK
LK_NBLCK 2 Synonym of _LK_NBLCK
LK_RLCK 3 Synonym of _LK_RLCK
LK_NBRLCK 4 Synonym of _LK_NBRLCK

_matherr Exception Types

Declared in: math.h
Name Value Meaning
_DOMAIN 1 Domain error
_SIGN 2 Argument singularity
_OVERFLOW 3 Overflow range error
_UNDERFLOW 4 Result too small
_TLOSS 5 Total loss of significance
_PLOSS 6 Partial loss of significance
DOMAIN 1 Synonym of _DOMAIN
SING 2 Synonym of _SING
OVERFLOW 3 Synonym of _OVERFLOW
UNDERFLOW 4 Synonym of _UNDERFLOW
TLOSS 5 Synonym of _TLOSS
PLOSS 6 Synonym of _PLOSS

Multi-byte Characters

Declared in: stdlib.h
Name Value Meaning
MB_CUR_MAX 1 Largest number of bytes in a multi-byte character for the current locale

_open Flag Values

Declared in: fcntl.h
Name Value Meaning
_O_RDONLY 0x0000 Read from file only
_O_WRONLY 0x0001 Write to file only
_O_RDWR 0x0002 Read and write from file
_O_APPEND 0x0008 Write only at end of file
_O_CREAT 0x0100 Create the file
_O_TRUNC 0x0200 Truncate file
_O_EXCL 0x0400 Fail if file exists
_O_TEXT 0x4000 Use translated mode
_O_BINARY 0x8000 Use untranslated mode
O_RDONLY 0x0000 Synonym of _O_RDONLY
O_WRONLY 0x0001 Synonym of _O_WRONLY
O_RDWR 0x0002 Synonym of _O_RDWR
O_APPEND 0x0008 Synonym of _O_APPEND
O_CREAT 0x0100 Synonym of _O_CREAT
O_TRUNC 0x0200 Synonym of _O_TRUNC
O_EXCL 0x0400 Synonym of _O_EXCL
O_TEXT 0x4000 Synonym of _O_TEXT
O_BINARY 0x8000 Synonym of _O_BINARY
_O_RAW 0x8000 Synonym of _O_BINARY

_osmode Values

Declared in: stdlib.h
Name Value Meaning
_DOS_MODE 0 DOS is running
_WIN_MODE 2 Windows is running

Random Numbers

Declared in: stdlib.h
Name Value Meaning
RAND_MAX 32767 Largest number returned by the rand function

Seek Origins

Declared in: io.h and stdio.h

Seek origins are used by fseek and _lseek.

Name Value Meaning
SEEK_SET 0 Seek relative to beginning of file
SEEK_CUR 1 Seek relative to current position
SEEK_END 2 Seek relative to end of file

setlocal Categories

Declared in: locale.h
Name Value Meaning
LC_ALL 0 All categories
LC_COLLATE 1 Collating sequence
LC_CTYPE 2 Character types
LC_MONETARY 3 Monetary formatting
LC_NUMERIC 4 Number formatting
LC_TIME 5 Time formatting

setvbuf Modes

Declared in: stdio.h
Name Value Meaning
_IOFBF 0x0000 Full buffering
_IONBF 0x0004 No buffering
_IOLBF 0x0040 Line buffering

signal Codes

Declared in: signal.h
Name Value Meaning
SIGINT 2 Interrupt
SIGILL 4 Illegal instruction
SIGBREAK 6 Control-break
SIGFPE 8 Math error
SIGSEGV 11 Segmentation violation
SIGTERM 15 Program termination request
SIGABRT 22 Abnormal termination
NSIG 23 The number of signals

signal Functions

Declared in: signal.h
Name Value Meaning
SIG_ERR -1 Signal could not be handled
SIG_DFL 0 Default signal handling
SIG_IGN 1 Ignore signal

_sopen Sharing Flag Values

Declared in: share.h
Name Value Meaning
_SH_COMPAT 0x00 Compatibility mode
_SH_DENYRW 0x10 Deny all access while file is open
_SH_DENYWR 0x20 Deny write access while file is open
_SH_DENYRD 0x30 Deny read access while file is open
_SH_DENYNO 0x40 Allow read/ write access while file is open
SH_COMPAT 0x00 Synonym of _SH_COMPAT
SH_DENYRW 0x10 Synonym of _SH_DENYRW
SH_DENYWR 0x20 Synonym of _SH_DENYWR
SH_DENYRD 0x30 Synonym of _SH_DENYRD
SH_DENYNO 0x40 Synonym of _SH_DENYNO

spawn Modes

Declared in: process.h
Name Value Meaning
_P_WAIT 0 Wait for child process to complate
_P_OVERLAY 2 Replace current process with child process
P_WAIT 0 Synonym of _P_WAIT
P_OVERLAY 2 Synonym of _P_OVERLAY

_splitpath Buffer Sizes

Declared in: stdlib.h
Name Value Meaning
_MAX_DIR 256 Largest directory
_MAX_EXT 256 Largest extension
_MAX_FNAME 256 Largest filename
_MAX_PATH 260 Largest path
_MAX_DRIVE 3 Largest drive

_stat st_mode Values

Declared in: sys\stat.h
Name Value Meaning
_S_IEXEC 0x0040 Handle refers to an executable file
_S_IWRITE 0x0080 Path or handle refers to a writable file
_S_IREAD 0x0100 Path or handle refers to a readable file
_S_IFCHR 0x2000 Handle refers to a character device
_S_IFDIR 0x4000 Path refers to a directory
_S_IFREG 0x8000 Path or handle refers to a regular file
S_IEXEC 0x0040 Synonym of _S_IEXEC
S_IREAD 0x0100 Synonym of _S_IREAD
S_IFCHR 0x2000 Synonym of _S_IFCHR
S_IFIDR 0x4000 Synonym of _S_IFDIR
S_IFREG 0x8000 Synonym of _S_IFREG

stdio.h Miscellaneous Values

Declared in: stdio.h
Name Value Meaning
EOF -1 End of file value
FOPEN_MAX 20 Largest number of files that can be open at once
_NFILE 40 or 60 Number of file handles
FILENAME_MAX 79 Largest filename
BUFSIZ 0x4000 Size of a buffer used by setbuf

Swap Error Codes

Declared in: swap.h
Name Value Meaning
SWAP_FREEMEMERROR -2 DOS refuses to shrink the primary memory block allocated for the program
SWAP_NOVMSPACE -3 Disk drive has no room to write program's image

Temporary Files

Declared in: stdio.h
Name Value Meaning
P_tmpdir "\\" Directory used for temporary files by tmpnam function
L_tmpnam 16 Largest filename generated by tmpfile function
TMP_MAX 32767 Largest number of unique file names generated by tmpnam function

tsr_install Arguments

Declared in: tsr.h
Name Value Meaning
TIMESLICE 1 Timeslice TSR
TSR_DEBUG 2 Debug TSR
POPONLY   Popup TSR

TSR Scancodes

Declared in: tsr.h
Name Value Meaning
NO_SCAN 0 No scancode
RSHIFT 1 Right shift
LSHIFT 2 Left shift
CTRL 4 Control
ALT 8 Alt
SCAN_Q 16 Q
SCAN_W 17 W
SCAN_E 18 E
SCAN_R 19 R
SCAN_T 20 T
SCAN_Y 21 Y
SCAN_U 22 U
SCAN_I 23 I
SCAN_O 24 O
SCAN_P 25 P
SCAN_A 30 A
SCAN_S 31 S
SCAN_D 32 D
SCAN_F 33 F
SCAN_G 34 G
SCAN_H 35 H
SCAN_J 36 J
SCAN_K 37 K
SCAN_L 38 L
SCAN_Z 44 Z
SCAN_X 45 X
SCAN_C 46 C
SCAN_V 47 V
SCAN_B 48 B
SCAN_N 49 N
SCAN_M 50 M
SCAN_F1 59 F1
SCAN_F2 60 F2
SCAN_F3 61 F3
SCAN_F4 62 F4
SCAN_F5 63 F5
SCAN_F6 64 F6
SCAN_F7 65 F7
SCAN_F8 66 F8
SCAN_F9 67 F9
SCAN_F10 68 F10
Home | Compiler & Tools | IDDE Reference | STL | Search | Download | Forums