www.delorie.com/gnu/docs/gcc/gnat_rm_10.html   search  
 
Buy the book!


GNAT Reference Manual

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

5.1 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.


  webmaster   donations   bookstore     delorie software   privacy  
  Copyright © 2003   by The Free Software Foundation     Updated Jun 2003