/sys$common/syshlp/helplib.hlb
FORTRAN, Data, Constants, Bit

 *Conan The Librarian (sorry for the slow response - running on an old VAX)

  A bit constant is a binary, octal, or hexadecimal constant.  You
  can use this type of constant wherever numeric constants are
  allowed and it assumes a numeric data type according to its
  context.

  A binary constant has the form:

    'c1c2c3...cn'B      c is a 0 or 1

  An octal constant has the form:

    'c1c2c3...cn'O      c is a digit in the range 0 - 7

  A hexadecimal constant has the form:

    'c1c2c3...cn'X      c is a digit in the range 0 - 9, or a letter
          or            in the range A - F, or a - f
    'c1c2c3...cn'Z

  Bit constants are "typeless" numeric constants.  They assume data
  types based on their usage, according to the following rules:

   o  When the constant is used with a binary operator, including the
      assignment operator, the data type of the constant is the data
      type of the other operand.

   o  When a specific data type is required, that type is assumed for
      the constant.

   o  When the constant is used as an actual argument, no data type
      is assumed; however, a length of 4 bytes is always used.

   o  When the constant is used in any other context, an INTEGER*4
      data type is assumed.

  Note that on VAX systems, the following example causes a
  data-typing problem:

     I = 80 * '01000000'X

  The quantity '01000000'X is typeless and assumes the data type of
  operand 80.  The compiler treats 80 as an INTEGER*2 quantity (since
  its value is within the range -32768 to 32767), and tries to
  convert '01000000'X to INTEGER*2.  Since '01000000'X is too large
  for the INTEGER*2 type, you get an error message.

  You can avoid this problem by giving the constant an INTEGER*4 type
  in a PARAMETER statement, as follows:

     INTEGER*4 K
     PARAMETER (K = '01000000'X)
  Close     HLB-list     TLB-list     Help  

[legal] [privacy] [GNU] [policy] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.