Delphi's list of operators, operators, and precedence tables good

Source: Internet
Author: User
Tags arithmetic operators bitwise bitwise operators class operator

List of operators for Delphi

Classification

Operator

Operation

Number of operands

Result type

Example

Arithmetic operators

+

Add

integers, real numbers

integers, real numbers

X + Y

-

Reducing

integers, real numbers

integers, real numbers

Result-1

*

By

integers, real numbers

integers, real numbers

P * InterestRate

/

Real number In addition

integers, real numbers

Real

X/2

Div

Integer except

Integer

Integer

Total Div unitsize

MoD

Take the mold

Integer

Integer

Y MoD 6

+ (one yuan)

Symbolic equivalents

integers, real numbers

integers, real numbers

+7

-(one Yuan)

Symbol opposite

integers, real numbers

integers, real numbers

-X

Boolean operator

Not

Negative

Boolean type

Boolean

Not (C in MySet)

and

And

Boolean type

Boolean

Done and (Total > 0)

Or

Or

Boolean type

Boolean

A or B

Xor

XOR or

Boolean type

Boolean

A XOR B

Logical (bitwise) operator

Not

Bitwise negation

Integer

Integer

Not X

and

Bitwise-AND

Integer

Integer

X and Y

Or

Bitwise OR

Integer

Integer

X or Y

Xor

Bitwise XOR OR

Integer

Integer

X XOR Y

Shl

Bitwise LEFT Shift

Integer

Integer

X SHL 2

Shr

Bitwise RIGHT SHIFT

Integer

Integer

Y SHR I

String operators

+

Connection

string, compressed string, character

String

S + '. '

Pointer operators

+

Pointer Plus

Character pointer, integer

Character pointer

P + I

-

Pointer minus

Character pointer, integer

Character pointer, integer

P-q

^

Pointer dismiss reference

Pointer

Base type of pointer

p^

=

Equal

Pointer

Boolean

P = Q

<>

Range

Pointer

Boolean

P <> Q

Set operators

+

and set

Collection

Collection

Set1 + Set2

-

Subtraction

Collection

Collection

S–t

*

Intersection

Collection

Collection

S * T

<=

Subset

Collection

Boolean

Q <= MySet

>=

Hyper-Set

Collection

Boolean

S1 >= S2

=

Equal

Collection

Boolean

S2 = MySet

<>

Range

Collection

Boolean

MySet <> S1

Inch

Members

Ordinal, set

Boolean

A in Set1

Relational operators

=

Equal

Simple types, classes, class references, interfaces, strings, compressed strings

Boolean

I = Max

<>

Range

Simple types, classes, class references, interfaces, strings, compressed strings

Boolean

X <> Y

<

Less than

Simple type, string, compressed string, PChar

Boolean

X < Y

>

Greater than

Simple type, string, compressed string, PChar

Boolean

Len > 0

<=

Less than or equal to

Simple type, string, compressed string, PChar

Boolean

Cnt <= 1

>=

Greater than or equal to

Simple type, string, compressed string, PChar

Boolean

I >= 1

Class operator

As

Transformation

Instances of classes and classes

Is

Judge

=

Relational operators = and <> are also used for classes

<>

Address (@) operator

@X

If x is a variable, then @x returns the address of X.  When the compilation indicator {$T-} is valid, @x is the pointer type; When the compiler indicates {$T +} state, @x is the ^t type, where T is the type of x.

@F

If f is a routine (function or procedure), then @f returns the entry point of F, and the type of @f is always pointer.

Methods in the @ class

When @ is applied to a method defined in a class, the method identifier must be qualified by the name of the class. For example: @TMyClass. dosomething

Delphi operators and Precedence

Monocular operator (highest priority)
@ Takes the address of a variable or function (returns a pointer)
Not logical inversion or bitwise inversion
Multiplication and bitwise operators
* Multiply or set intersection
/ Divide floating point
Div Dividing integers
MoD Modulo (the remainder of dividing integers)
As Program run stage type conversion (Rtti operator)
and Logical OR Bitwise summation
Shl Bitwise LEFT Shift
Shr Bitwise RIGHT SHIFT
Add and Subtract operators
+ Add, set merge set, string join, or pointer increment an offset
- Subtract, set difference set, or pointer reduce an offset
Or Logical OR bitwise OR operation
Xor Logical OR bitwise XOR OR operation
Relationship and comparison operators (lowest priority)
= Judging if they are equal
<> Judging if they are not equal
< Judging if it is less than
> Judging if it is greater than
<= Determines whether it is less than or equal to, or whether it is a subset of a collection
>= Determines whether the parent set is greater than or equal to, or is a collection
Inch Determines whether a collection member
Is Determine if an object is type compatible (another rtti operator)

Reference: http://blog.csdn.net/sforiz/article/details/6680690

Delphi's list of operators, operators, and precedence tables good

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.