| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
For ordinal types:
procedure Dec (var x: ordinal type); |
procedure Dec (var x: ordinal type; Amount: Integer); |
For pointer types:
procedure Dec (var p: any pointer type); |
procedure Dec (var p: any pointer type; Amount: Integer); |
For ordinal types, `Dec' decreases the value of `x' by one or by `amount' if specified.
If the argument `p' is pointing to a specified type (typed pointer), `Dec' decreases the address of `p' by the size of the type `p' is pointing to or by `amount' times that size respectively. If `p' is an untyped pointer (i.e. `p' is of type section 9.196 Pointer), `p' is decreased by one, otherwise by `amount' if specified.
`Dec' is a Borland Pascal extension. The combination of the second argument with application to pointers is a GNU extension.
program DecDemo;
var
x: Integer;
y: array [1 .. 5] of Integer;
p: ^Integer;
begin
x := 9;
Dec (x, 10); { yields -1 }
{$X+} { Turn on extended systax }
p := @y[5]; { p points to y[5] }
Dec (p, 3) { p points to y[2] }
end.
|
section 9.115 Inc, section 9.201 Pred, section 9.271 Succ, section 8.6 Pointer Arithmetics.