Professional Documents
Culture Documents
Ansi
Ansi
-------------------------------------Certain aspects of the ANSI C standard are not defined exactly by ANSI.
Instead, each implementor of a C compiler is free to define these aspects
individually. This chapter tells how Borland has chosen to define these
implementation-specific standards. The section numbers refer to the
February 1990 ANSI Standard. Remember that there are differences between
C and C++; this appendix addresses C only.
2.1.1.3 How to identify a diagnostic.
When the compiler runs with the correct combination of options, any
message it issues beginning with the words Fatal, Error, or Warning
are diagnostics in the sense that ANSI specifies. The options needed
to insure this interpretation are in the following table. The options are
listed as hot keys you use in the IDE. For example, the first option
corresponds to Options|Compiler|Source, and in the Source Options
dialog box you'd choose ANSI for the Keyword option.
----------------------------------------------------------------------------Option
Action
----------------------------------------------------------------------------O|C|S|A
Enable only ANSI keywords.
O|C|S|N
No nested comments allowed.
O|C|E|C
Use C calling conventions.
O|C|S|I
At least 32 significant characters in identifiers.
O|C|M|D|S
Turn off all warnings except selected ones.
O|C|M|A|I
Turn on warning about inappropriate initializers.
O|C|M|P|C
Turn on warning about non-portable pointer comparisons.
O|C|M|A|R
Turn on warning about duplicate non-identical definitions.
O|C|M|A|S
Turn on warning about suspicious pointer conversion.
O|C|P|N
Turn on warning about non-portable pointer conversion.
O|C|M|A|V
Turn on warning about void functions returning a value.
O|C|M|A|H
Turn on warning about hexadecimal values containg more than
3 digits.
O|C|M|P|M
Turn on warning about mixing pointers to signed and unsigned
char.
O|C|M|A|U
Turn on warning about undefined structures.
O|C|M|A|X
Turn on warning about variables declared both as external and
as static.
----------------------------------------------------------------------------Choose Options|Compiler|Code Generation and specify Never under SS = DS.
Also don't change the default values in the Segment Names dialog box under
Options|Compiler|Names; each text box should contain an asterisk (*).
Other options not specifically mentioned here can be set to whatever
you desire.
2.1.2.2.1 The semantics of the arguments to main.
The value of argv[0] is a pointer to a null byte when the program is
run on DOS versions prior to version 3.0. For DOS version 3.0 or
later, argv[0] points to the program name.
The remaining argv strings point to each component of the DOS
command-line arguments. Whitespace separating arguments is removed,
and each sequence of contiguous nonwhitespace characters is treated
as a single argument. Quoted strings are handled correctly (that is,
as one string containing spaces).
Objects declared with any two-byte integer or pointer types can be placed
in registers. The compiler will place any small auto objects into registers,
but objects explicitly declared as register will take precedence. At least
two and as many as six registers are available. The number of registers
actually used depends on what registers are needed for temporary values
in the function.
3.5.2.1 Whether a plain int bit-field is treated as a signed int or as an
unsigned int bit field.
Plain int bit fields are treated as signed int bit fields.
3.5.2.1 The order of allocation of bit fields within an int.
Bit fields are allocated from the low-order bit position to the high-order.
3.5.2.1 The padding and alignment of members of structures.
By default, no padding is used in structures. If you use the alignment
option (O|C|C|W), structures are padded to even size, and any members that
do not have character or character array type will be aligned to an even
offset.
3.5.2.1 Whether a bit-field can straddle a storage-unit boundary.
When alignment (O|C|C|W) is not requested, bit fields can straddle word
boundaries, but will never be stored in more than two adjacent bytes.
3.5.2.2 The integer type chosen to represent the values of an enumeration
type.
If all enumerators can fit in an unsigned char, that is the type
chosen. Otherwise, the type is signed int.
3.5.3 What constitutes an access to an object that has volatile-qualified
type.
Any reference to a volatile object will access the object. Whether
accessing adjacent memory locations will also access an object depends on
how the memory is constructed in the hardware. For special device memory,
like video display memory, it depends on how the device is constructed. For
normal PC memory, volatile objects are only used for memory that might be
accessed by asynchronous interrupts, so accessing adjacent objects has no
effect.
3.5.4 The maximum number of declarators that can modify an arithmetic,
structure, or union type.
There is no specific limit on the number of declarators. The number of
declarators allowed is fairly large, but when nested deeply within a set
of blocks in a function, the number of declarators will be reduced. The
number allowed at file level is at least 50.
3.6.4.2 The maximum number of case values in a switch statement.
There is no specific limit on the number of cases in a switch. As long
as there is enough memory to hold the case information, the compiler
will accept them.
3.8.1 Whether the value of a single-character character constant in a
at the beginning of the file. It is reset to the end of the file before
each write.
4.9.3 Whether a write on a text stream causes the associated file to be
truncated beyond that point.
A write of 0 bytes may or may not truncate the file, depending upon
how the file is buffered. It is safest to classify a zero-length write
as having indeterminate behavior.
4.9.3 The characteristics of file buffering.
Files can be fully buffered, line buffered, or unbuffered. If a file is
buffered, a default buffer of 512 bytes is created upon opening the file.
4.9.3 Whether a zero-length file actually exists.
Yes, it does.
4.9.3 Whether the same file can be open multiple times.
Yes, it can.
4.9.4.1 The effect of the remove function on an open file.
No special checking for an already open file is performed; the
responsibility is left up to the programmer.
4.9.4.2 The effect if a file with the new name exists prior to a call to
rename.
rename will return a -1 and errno will be set to EEXIST.
4.9.6.1 The output for %p conversion in fprintf.
In near data models, four hex digits (XXXX). In far data models, four
hex digits, colon, four hex digits (XXXX:XXXX).
4.9.6.2 The input for %p conversion in fscanf.
See 4.9.6.1.
4.9.6.2 The interpretation of an - (hyphen) character that is neither the
first nor the last character in the scanlist for a %[ conversion in fscanf.
See the description of scanf in the Help system.
4.9.9.1 The value to which the macro errno is set by the fgetpos or ftell
function on failure.
EBADF
Permission denied
Invalid argument
Bad file number
Arg list too big
Memory arena trashed
Exec format error
Not enough memory
Cross-device link
Invalid memory block address
Math argument
Invalid environment
Result too large
Invalid format
File already exists
Invalid access code
--------------------------------------------------------------------------See perror in the Help system for details.
4.10.3 The behavior of calloc, malloc, or realloc if the size requested is
zero.
calloc and malloc will ignore the request. realloc will free the block.
4.10.4.1 The behavior of the abort function with regard to open and temporary
files.
The file buffers are not flushed and the files are not closed.
4.10.4.3 The status returned by exit if the value of the argument is ]
other than zero, EXIT_SUCCESS, or EXIT_FAILURE.
Nothing special. The status is returned exactly as it is passed. The
status is a represented as a signed char.
4.10.4.4 The set of environment names and the method for altering the
environment list used by getenv.
The environment strings are those defined in DOS with the SET command.
putenv can be used to change the strings for the duration of the current
program, but the DOS SET command must be used to change an environment
string permanently.
4.10.4.5 The contents and mode of execution of the string by the system
function.
The string is interpreted as a DOS command. COMMAND.COM is executed and
the argument string is passed as a command to execute. Any DOS built-in
command, as well as batch files and executable programs, can be executed.
4.11.6.2 The contents of the error message strings returned by strerror.
See 4.9.10.4.
4.12.1 The local time zone and Daylight Saving Time.
Defined as local PC time and date.
4.12.2.1 The era for clock.
Represented as clock ticks, with the origin being the beginning of the
program execution.
4.12.3.5 The formats for date and time.
Turbo C++ implements ANSI formats.