2 Copyright 1988-2022 Free Software Foundation, Inc.
3 This is part of the GCC manual.
4 For copying conditions, see the copyright.rst file.
6 .. index:: TRANSFER, bits, move, type cast
10 TRANSFER --- Transfer bit patterns
11 **********************************
13 .. function:: TRANSFER(SOURCE, MOLD, SIZE)
15 Interprets the bitwise representation of :samp:`{SOURCE}` in memory as if it
16 is the representation of a variable or array of the same type and type
17 parameters as :samp:`{MOLD}`.
20 Shall be a scalar or an array of any type.
23 Shall be a scalar or an array of any type.
26 (Optional) shall be a scalar of type
30 The result has the same type as :samp:`{MOLD}`, with the bit level
31 representation of :samp:`{SOURCE}`. If :samp:`{SIZE}` is present, the result is
32 a one-dimensional array of length :samp:`{SIZE}`. If :samp:`{SIZE}` is absent
33 but :samp:`{MOLD}` is an array (of any size or shape), the result is a one-
34 dimensional array of the minimum length needed to contain the entirety
35 of the bitwise representation of :samp:`{SOURCE}`. If :samp:`{SIZE}` is absent
36 and :samp:`{MOLD}` is a scalar, the result is a scalar.
42 Transformational function
45 .. code-block:: fortran
47 RESULT = TRANSFER(SOURCE, MOLD[, SIZE])
50 .. code-block:: fortran
53 integer :: x = 2143289344
54 print *, transfer(x, 1.0) ! prints "NaN" on i686