-Cni: No Integral Promotion

Group

OPTIMIZATIONS

Scope

Function

Syntax
-Cni

Arguments

None

Default

None

Defines

__CNI__

Pragmas

None

Description

Enhances code density of character operations by omitting integral promotion. This option enables a non ANSI-C compliant behavior.

In ANSI-C operations with data types, anything smaller than int must be promoted to int (integral promotion). With this rule, adding two unsigned character variables results in a zero-extension of each character operand, and then adding them back in as int operands. If the result must be stored back into a character, this integral promotion is not necessary. When this option is set, promotion is avoided where possible.

The code size may be decreased if this option is set because operations may be performed on a character base instead of an integer base.

The -Cni option enhances character operation code density by omitting integral promotion.

Consider the following:

Example

See the following listing for an example of "no integer promotion."

Listing: Definition of an `old style function' using a char parameter.


old_style_func (a, b, c)
  char a, b, c;

{

  ...

}

The space reserved for a, b, and c is just one byte each, instead of two.

For expressions containing different types of variables, the following conversion rules apply: