HP Pascal/iX Reference Manual (31502-90022)

9- 18
PROCEDURE x (p : ptrtype; n : integer);
BEGIN
assert(p <> nil, 80101, my_assert);
assert(n >= 0, 80102);
END;
MPE V Migration Routines
baddress
Usage
baddress
(v)
Parameters
v
A variable, procedure, or function.
Description
The function
baddress(v)
returns the byte address of
v
when
v
is a
variable name, and the entry point when
v
is a procedure or function
name. This variable may not be type file or a file type component of a
structured variable. Also,
v
cannot be a component of a packed
structure, except if it is a component of a PAC.
baddress
is useful for calling certain intrinsics which require byte
addresses for parameters.
baddress
returns an integer in the range
minint..maxint
.
NOTE [REV BEG]
baddress
does not work correctly with the $OPTIMIZE compiler option
for addresses of variables. Use type coercion and addr[REV END]
instead. Refer to the
HP Pascal/iX Programmer's Guide
or to the
HP
Pascal/HP-UX Programmer's Guide
, depending on your implementation,
for more information on optimizer assumptions.
Example
TYPE
rec_type = RECORD
f1: integer;
f2: boolean;
f3: char;
END;
VAR
n: integer;
r: rec_type;
p: ^rec_type;
a: ARRAY [1..10] of 0..255;
pac: PACKED ARRAY [1..10] OF char;
pab: PACKED ARRAY [1..10] OF boolean;
Calls
baddress(n)
baddress(r)
baddress(r.f3)
baddress(p)