Document: WG14 N1323


Pure imaginary types with classification macros


Submitter: Fred Tydeman (USA)
Submission Date: 2008-07-13
Previous version of paper: N1304
Subject: Pure imaginary types with classification macros

When complex and imaginary were added to C99, most people were only thinking in terms of complex. Some restrictions were added which makes sense for complex (as they have no meaning). Unfortunately, that wording also outlawed the use of those operators with pure imaginary types (where they do have a meaning).

The committee rejected the idea of allowing pure imaginary with increment/decrement operators, with relational operators and/or with comparison macros.

This proposal relaxes constraints to allow imaginary types (along with real types) to some operators.

Add new sections to C1x:

G.? Uniary operators

G.5.? Classification macros

This section supplements the "constraints" section of 7.12.3 in that imaginary type is allowed.

Add to Rationale:

The relational operators (<, <=, >=, >) may be used with pure imaginary types by using the cimag() function, e.g., cimag(x) < cimag(y).

The comparison macros (isgreater, isgreaterequal, isless, islessequal, islessgreater, isunordered) may be used with pure imaginary types by using the cimag() function, e.g., isless(cimag(x), cimag(y)).