[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
function Pred (i: ordinal type): ordinal type; |
function Pred (i: ordinal type; j: Integer): ordinal type; |
or, with extended syntax (`--extended-syntax' or `{$X+}'),
function Pred (p: Pointer type): Pointer type; |
function Pred (p: Pointer type; j: Integer): Pointer type; |
Returns the predecessor of the ordinal type value `i', or, if the second argument `j' is given, its `j'th predecessor. For integer values `i', this is `i - 1' (or `i - j'). (No, `Pred' does not work faster than plain subtraction. Both are optimized to a single machine instruction or even expanded by the compiler, if possible.)
If extended syntax is on, the argument may also be a pointer value. In this case, the address is decremented by the size of the variable pointed to, or, if `j' is given, by `j' times the size of the variable pointed to. If `p' points to an element of an array, the returned pointer will point to the (`j'th) previous element of the array.
The `Pred' function is defined in ISO-7185 Pascal. The optional second parameter is defined in ISO-10206 Extended Pascal. Application of `Pred' to pointers is defined in Borland Pascal. The combination of the second argument with application to pointers is a GNU extension.
program PredDemo; |
section 9.271 Succ, section 9.59 Dec, section 8.6 Pointer Arithmetics.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |