Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP-UX Systems: HP C/HP-UX Release Notes > Chapter 1 HP C/HP-UX Release Notes

What’s in This Version

» 

Technical documentation

Complete book in PDF
» Feedback
Content starts here

 » Table of Contents

This section gives an overview of the new features introduced in this version of the HP C compiler.

New Features in Version B.11.11.08

HP C compiler version B.11.11.08 supports the following new features:

restrict Keyword

This is a C99 feature. The restrict keyword tells the optimizer that variables declared as restrict cannot have aliases (using pointers). Thus the optimizer can do better alias analysis.

As of the current release, only the keyword is supported without any accompanying optimizations.

__typeof__ Operator

A typeof-construct can be used anywhere a typedef name is used. For example, you can use it in a declaration, in a cast, or inside of sizeof or __typeof__. __typeof__ is another way to refer to the type of an expression.

This example declares y as an array of type of what x points to.

__typeof__ (*x) y[4];

This declares y as an array of pointers to characters:

__typeof__(__typeof__(char *)[4]) y;

__restrict__ Keyword

This keyword can be used to indicate to the optimizer that the associated variable declared with this qualifier will not have aliases (using pointers). This will help in better code optimization.

NOTE: __restrict__ qualifier can only be used with pointers.

Examples:

int a = 10;

int *__restrict__ b = &a;

__volatile__ Keyword

This is equivalent to the volatile keyword.

Usage:

__volatile__ int var;

C99 Mode with -AC99 Option

This option needs to be used in order to use the C99 specific features. For example, it enables keywords like restrict, and typeof to be recognized. (Without this option, the keywords __restrict__ and __typeof__ need to be used).

+We[n1,n2,...,nN] Option to Flag Warnings as Errors

Using this option causes the compiler warnings n1, n2, ..., nN to be converted into error messages. If no numbers are specified, then most warnings, except a selected few, are converted into errors.

Non-Constant Initializers for Aggregates

Now it is possible to specify non-constant expressions as initializers in the initialization lists of aggregates, such as arrays and structures. The expressions can be any valid C expressions, such as arithmetic expressions involving variables, and even function calls.

Earlier it was only possible to specify constant expressions as initializers of aggregates.

Example usage:

int i, j;
/* ... */
int iarr[] = { i, j, i + j, i - j };

—include <file> Option

This option causes the compiler to insert <file> at the beginning of a set of translation units, before processing the translation units.Effectively, it executes implicit #include "<file>" directives for each -include <file> option on the command line, before the very first line of each of the source files specified on the command line. This is a GCC compatibility feature.

Example Usage:

$ cc [cc opts] [-include <file>]* [cc opts] <source file(s)>

where, [-include <file>]* stands for 0 or more -include <file> options.

All the -include options are processed in the order in which they are written.

+O[no]clone Option

This option allows the user to turn on[off] the cloning facility of the optimizer. Cloning is on by default. It is mainly provided for users who may see a lot of cloning adversely affecting the performance of their code.

If inlining is turned off, cloning is turned off by default. You cannot specify +Onoinline +Oclone.

+Olit=[all|const|none] Option

The +Olit option specifies the type of data items placed in the read-only data section. It can take the values all, const and none.

+Olit=all places all string variables and all const-qualified variables that do not require load-time or run-time initialization in the read-only data section.

+Olit=const places all string literals appearing in a context where const char * is legal, and all const-qualified variables that do not require load-time or run-time initialization in the read-only data section.

If +Olit=none is specified, no constants are placed in the read-only data section.

+O[no]memory[=malloc] Option

This option enables[disables] memory optimizations. Specifying malloc in the list enables[disables] optimizations which consolidate memory allocation procedure calls. This option is disabled by default. It is incompatible with +OopenMP and +Oparallel, and is ignored when these options are in effect.

Assigned goto Feature

Assigned goto is a gcc compatibility feature, to use labels as values. The address of a label defined in the current function can be got using the unary operator &&. The value has type void *.

For example:

void *ptr;
/* ... */
ptr = && label_foo;

To use these values, the user must be able to jump to one. This is done with the computed goto statement(1), goto *EXP;. For example,

goto *ptr;

Any expression of type void * is allowed.

__label__ Feature to Locally Declare Labels

A local label is simply an identifier. You can jump to it with an ordinary goto statement, but only from within the compound statement it belongs to.

The syntax for a local label is given below:

__label__ LABEL;

or

__label__ LABEL1, LABEL2, ...;

HPC_DEBUG_COMPAT Environment Variable

HP C does not emit debug information for unused objects (structures, unions, and others) anymore with the -g option. For getting the older behavior (emitting debug information for all objects, irrespective of whether they are used in the program or not), the environment variable HPC_DEBUG_COMPAT can be set in the environment along with the -g option in the compilation command line. It suffices to define this environment variable to have an empty string; it does not need to be set to any particular value.

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 2003 Hewlett-Packard Development Company, L.P.