Re: BOZ literal constants, a puzzle for us Standard-loving types.



Steven G. Kargl wrote:

(snip)

There are no negative integers in gfortran. There is a unary
minus operator and whole numbers. :)

Traditionally DATA statements were maybe the only place where
signed constants were allowed. In F2003:

data-stmt-constant is scalar-constant
or scalar-constant-subobject
or signed-int-literal-constant
or signed-real-literal-constant
or null-init
or structure-constructor

Bit patterns for reals can be done with TRANSFER. Yes, it isn't
portable, but REAL(BOZ) isn't portable either. I'm almost tempted
to suggest that J3 was smoking crack when it approved using BOZs
in REAL, INT, and CMPLX. It appears to be a broken attempt to fix the broken semantics of TRANSFER.

Maybe a concession to the fact that no solution is perfect,
but sometimes you need to do it anyway. I suppose I like the
REAL form better than just putting Z constants into DATA statements,
as some compilers used to allow. As far as I know, OS/360 Fortran
is the beginning of Z constants and the Z format descriptor.
(The more obvious X format descriptor already taken.)

-- glen

.