Node: Intrinsic Operators, Next: , Up: Intrinsic Subprograms

Intrinsic Operators

All predefined operators can be used in pragma Import (Intrinsic,..) declarations. In the binary operator case, the operands must have the same size. The operand or operands must also be appropriate for the operator. For example, for addition, the operands must both be floating-point or both be fixed-point. You can use an intrinsic operator declaration as in the following example:

        type Int1 is new Integer;
        type Int2 is new Integer;
        function "+" (X1 : Int1; X2 : Int2) return Int1;
        function "+" (X1 : Int1; X2 : Int2) return Int2;
        pragma Import (Intrinsic, "+");

This declaration would permit "mixed mode" arithmetic on items of the differing types Int1 and Int2.