User guide

2.2. EXPRESSIONS 15
The following are exam p l es of valid nu mbers:
1234
1_234_456
#B_1011_1100_0110
#o377
#X3fff
#x_DEADC0DE
Since August 2014, floating point constants are now allowed, such as the
following:
1234.0
1.234_456e-5
10e0
A floating point constant must start with a d i gi t and contain a decimal point
(.) or an exponent sign (e or E). BCPL floating point numbers are the same
size as other BCPL words and so, on 32-bit implementations, the precision is
limited to about 6 decimal places. BCPL floating point will be more useful
when it becomes available on 64-bit versions of BCPL. The compiler do es not
know the target representation of floatin g point values and so they cannot be
used in m anifest con st ants. The IEEE floating point stand a r d is used for the
representation of floating point number. For instance, for 32-bit numbers there
is one sign bit, 8 expon ent bits and 23 significand bits.
TRUE and FALSE are reserved words that have valu es -1 and 0, respectively,
representing the two t r u t h values. They can be used in manifest constant expres-
sions. Whenever a boolean test is m a d e, the value is compared with with FALSE
(=0). BITSPERBCPLWORD is also a reserved word whose value is 32 or 64 depend-
ing on whether the BCPL com piler is running on a 32 or 64-bit system. This
constant was added on 16 May 2013 t o allow the same h eader file to be used on
both 32- and 64-bit Cintcode systems. It is used in the MANIFES T declarations
of constants such as bytesperword and minint that are word length dependent .
If you are using an older BCPL compiler with the latest version of libhdr.h you
will need to un-comment a line that declares BITSPERBCPLWORD as a MANIFEST
constant with the appropriat e val u e for the system you are using.
A question mark (?) may be u sed as a constant with undefined value. It can
be used in statements such as:
LET a, b, count = ?, ?, 0
sendpkt(notinuse, rdtask, ?, ?, Read, buf, size)
Constants of the form: SLCT len:shift:offset pack the t h r e e constants len,
shift and offset i nto a word. Such packed constants are used by the field selection
operator OF to access fields of given length, shift and offset relative to a pointer
as described in Section 2.2.6. The len and shift components are optional. Their
omission has the following effect.