HP 3000 Manuals

HP C/XL Enhancements [ COMMUNICATOR 3000/XL XL RELEASE 2.1 ] MPE/iX Communicators


COMMUNICATOR 3000/XL XL RELEASE 2.1

HP C/XL Enhancements 

by Erryl Johnson 
Systems Technology Division 

The HP C/XL compiler, preprocessor, header files, and libraries are
enhanced to provide complete conformance to the ANSI standard for the C
language, X3.159-1989.  A new compiler option, -Aa, allows the programmer
to enable ANSI mode.

With ANSI mode enabled by the -Aa option, the compiler accepts a number
of new language features, many of which are designed to make C a safer
language, but without diminishing the freedom which has traditionally
been available to the C programmer.  It does more thorough error
checking, with the result that more bugs will be detected at compile time
rather than run time.  It also promotes portability by guaranteeing
standard handling of certain language features which have frequently been
trouble spots, such as macro expansion and integral promotion rules.

Another new compiler option, -Ac (the default), is provided for programs
which rely on certain nonstandard behaviors of pre-ANSI compilers or
preprocessors, including previous releases of HP C. This option allows
existing programs which compiled without warning on previous releases of
HP C/XL to continue to compile and execute properly.

ANSI is the recommended mode of compilation.  Many (if not most) existing
programs will compile and execute properly under ANSI C with no changes.
Unless you need to port your code to a system where an ANSI C compiler is
not yet available, it is suggested that you use ANSI mode whenever you
need to recompile existing programs.

If you would like to override the current default and make ANSI mode the
default, you may do so by establishing a CCOPTS CI variable containing
the -Aa option (:SETVAR CCOPTS "-Aa").

NEW HP C/XL ANSI FEATURES 

Following is a partial list of the new features available to the
programmer in ANSI mode:

Function prototypes provide a means of specifying the number of
parameters to a function and the type of each parameter.  On calls to the
function, the arguments will be checked for compatibility with the
parameters, and automatic conversions will be performed where
appropriate.

The program's namespace is protected.  ANSI C provides a well defined
list of reserved words, with the guarantee that all other identifiers can
be safely used by the programmer.

Multicharacter constants, such as 'xyz', are accepted.

Concatenation of string literals is supported.  The adjacent tokens "abc"
and "pqr", even if on separate lines and separated by a comment, will be
joined into a single token "abcpqr".

The preprocessor supports the new directives #error and #elif, as well as
the # and ## operators.  Directives can be indented.  Compilation date
and time are available with the macros __DATE__ and __TIME__.

The type qualifiers const and volatile are fully supported.

The suffixes "U" (unsigned) and "F" (float) are permitted in arithmetic
constants.

Automatic arrays and structures can be initialized.  Unions can be
initialized.  Unions can contain bit-fields.

The data type "long double" provides 128-bit floating-point arithmetic.
Values with type "float" are not promoted automatically to "double".

Trigraphs provide a way of representing the basic C character set on
non-ASCII terminals and printers.

Internationalization is supported by wide character constants, wide
string literals, and standard library routines for manipulating strings
of multibyte characters and wide characters.

OTHER NEW FEATURES 

Prior to XL Release 2.1, an incorrect result could be returned from the
'ctime' function if the TZ variable and/or the hardware clock were set
incorrectly.  The 'time' function, which is used in combination with
'ctime', has been modified to eliminate the possibility of an incorrect
result.

OTHER NEW FEATURES 

The HP C Reference Manual and the HP C/XL Reference Manual Supplement are
combined into a single new manual, the HP C/XL Reference Manual (P/N
31506-60001), which is thoroughly revised to reflect the new features of
the language.



MPE/iX Communicators