RAD Studio |  |

compl, ~

Category

Alternative Representations of Operators and Tokens, Operators

Syntax

Description

The compl operator is an alternative representation of the ~operator ( bitwise NOT).

The compl operator is the abbreviation for complement.

compl Inverts true to false and false to true, The tilde (~) is placed in front of the integer used for the complement.

The complement of 1 would be 0, and vice versa.

Besides an integer, ~ also outputs an enumeration type; this can be the result of the one’s complement of the operand. Integral calculations are performed.

The type of the result is the type of the promoted operand.

There can be ambiguity in the unary expression ~X(), where X is a class-name. The ambiguity is resolved in favor of treating ~ as a unary complement rather than treating ~X as a destructor.

In order to use the compl operator, you need to check the Enable new operator names option (the -VM compiler switch, available on the Compatibility page of the ProjectOptions dialog box).

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!