Delphi Language Guide Delphi for Microsoft Win32 Delphi for the Microsoft. Net framework



Yüklə 0,84 Mb.
Pdf görüntüsü
səhifə67/294
tarix02.01.2022
ölçüsü0,84 Mb.
#41395
1   ...   63   64   65   66   67   68   69   70   ...   294
DelphiLanguageGuide

Pointer Operators
The relational operators <><=, and >= can take operands of type PChar and PWideChar (see Relational
operators). The following operators also take pointers as operands. For more information about pointers, see
Pointers and pointer types.
Character-pointer operators
Operator Operation
Operand Types
Result Type
Example
+
pointer addition
character pointer, integer character pointer
P + I
-
pointer subtraction character pointer, integer character pointer, integer
P - Q
^
pointer dereference pointer
base type of pointer
P^
=
equality
pointer
Boolean
P = Q
<>
inequality
pointer
Boolean
P <> Q
The ^ operator dereferences a pointer. Its operand can be a pointer of any type except the generic Pointer, which
must be typecast before dereferencing.
51


P = Q
 is True just in case 
P
 and 
Q
 point to the same address; otherwise, 
P <> Q
 is True.
You can use the + and - operators to increment and decrement the offset of a character pointer. You can also
use - to calculate the difference between the offsets of two character pointers. The following rules apply.
If 
I
 is an integer and 
P
 is a character pointer, then 
P + I
 adds 
I
 to the address given by 
P
; that is, it returns a
pointer to the address 
I
 characters after 
P
. (The expression 
I + P
 is equivalent to 
P + I
.) 
P - I
 subtracts
I
 from the address given by 
P
; that is, it returns a pointer to the address 
I
 characters before 
P
. This is true for
PChar pointers; for PWideChar pointers 
P + I
 adds 
SizeOf(WideChar)
 to 
P
.
If 
P
 and 
Q
 are both character pointers, then 
P - Q
 computes the difference between the address given by 
P
(the higher address) and the address given by 
Q
 (the lower address); that is, it returns an integer denoting the
number of characters between 
P
 and 
Q

P + Q
 is not defined.
Set Operators
The following operators take sets as operands.

Yüklə 0,84 Mb.

Dostları ilə paylaş:
1   ...   63   64   65   66   67   68   69   70   ...   294




Verilənlər bazası müəlliflik hüququ ilə müdafiə olunur ©azkurs.org 2024
rəhbərliyinə müraciət

gir | qeydiyyatdan keç
    Ana səhifə


yükləyin