Pascal essential notes

xiaoxiao2021-03-06  66

Pascal essential notes

There is an exception to the case where the PASCAL language is not sensitive: the Register process in the control package must begin with uppercase letter R because it is necessary to be compatible with C Builder.

The compiler does not compile the space in the code, the empty line, and Tab key spaces, which are generally called blank, which is only used to improve the readability of the code, which does not affect the compilation process. (That is, = this way of writing is no problem, I originally thought that it is the problem!)

Remember to use code template (easy to develop) shortcuts: Ctrl J

Absolute keywords are shared variable addresses with some icons of C . Var str: string [32]; strlen: Byte Absolute Str; BYTE ABSOLUTE STR;

In contrast to most programming languages, the priority of the And and OR operators in the Pascal language is higher than the relationship operator. Therefore, if your code is a

Collection, set in addition to and ( ) difference (-) ration (*), etc., can be used in both incrude and Exclude efficiency

INCLUDE (Style, Fsbold);

When the time and date are converted into a string, its conversion format depends on Windows system settings.

Round conversion a real value is the integer value of rounding

Note: In the most recent version of the Delphi Pascal compiler, the Round function is based on the CPU's FPU (floating point component) processor. This processor uses a so-called "Bank Home Relievance", that is, when implementing the Round function of the intermediate value (such as 5.5, 6.5), the processor determines the rounding or not, according to the odd plurality of the digital, even the number of numbers, such as 5.5 The result is 6, and the 6.5 Round result is also 6 because 6 is even. Not just Delphi (VB is like this)

Note: In general, you should avoid using the above-mentioned non-named types because you can't transfer them as a parameter, and you cannot use other variables that are named the same type. In fact, PASCAL's type compatibility rules are based on type name instead of the actual type definition. The same variables of two types may still be incompatible unless their types have exactly the same name. For non-named types, the compiler is required to assign an internal name, so the complicated variables for the data structure are used to define the named data type, you will not be a white feet.

Delphi compiles, but when running, if you open the range check compilation option (in the Compiler page settings of the Engineering Options dialog), you will get the Range Check Error information.

Note: It is recommended that you turn on the above-described compile option when developing programs to make the program more robust and easy to debug. This way, even if you encounter an error, you will get a clear information rather than difficult to ponder. You can remove this option when you finalize the program, so that the program is running fast, but it has little effect. So I suggest that you open all runtime detection options, such as overflow checks and stack checks, or even submit them when you submit procedures.

The Delphi long string is slightly different, and the long string looks like a reference, but if you change the string variable of the string, then this string will be copied before the update. A long string that is transmitted as a value is only reference only in terms of memory usage and operation speed, but if you change the value of the string, the initial value will not be affected. Conversely, if the long string is transmitted by reference, the initial value of the string can be changed. The value of substantially string is similar to reference, but the system is operated behind the scenes, which is low.

It is not often used in Delphi, but you often use an extremely similar structure-reference (References). Each object instance is actually an implicit pointer, or is a reference to its actual data. Using reference, you can use object variables like other data types.

When the parameter is passed by reference, the reference parameter is labeled keyword VAR.

Procedure Doublethevalue (VARUE: Integer);

Delphi 3 adds a new parameter: OUT. The OUT parameter does not have an initial value, just used to return a value. OUT parameters should only be used for COM processes and functions, in general, preferably use more efficient VAR parameters. In addition to this, the OUT parameter is the same as the VAR parameters except for the initial value.

Constant parameters, unable to change the passed value in the process or function. Can only be used.

If you only pass a part of the array, you can use the SLICE function,

Ming a process or function, and only give its name and parameters, do not list the current code, need to add Forward key in the sentence:

Key words table

Keyword

effect

Absolute

Directive (variable)

Abstract

Directive (method)

and

Operator (Boole)

array

Types of

AS

Operator (RTTI)

ASM

Statement

Assembler

Backward compatibility (assembly)

AT

Statement (exception handling)

Automated

Access class (class)

Begin

Block mark

Case

Statement

CDECL

Function call protocol

Class

Types of

Const

Declaration or instructions (parameters)

Constructor

Special method

Contains

Operator (collection)

DEFAULT

Directive (attribute)

Destructor

Special method

Dispid

Dispinterface interface category

DISPINTERFACE

Types of

Div

Operator

DO

Statement

Downto

Statement (for)

Dynamic

Directive (method)

Else

Statement (IF or CASE)

end

Block mark

Except

Statement (exception handling)

Export

Backward compatibility (class)

Exports

statement

EXTERNAL

Directive (function)

FAR

Backward compatibility (class)

File

Types of

Finalization

Unit structure

Finally

Statement (exception handling)

for

Statement

Forward

Function instruction

FUNCTION

statement

goto

Statement

IF

Statement

IMPLEMentation

Unit structure

IMPLEMENTS

Directive (attribute)

in

Operator (collection) - engineering structure

Index

DIPINTERFACE interface)

inherited

Statement

INITIALIZATION

Unit structure

inline

Backward compatibility (see ASM)

Interface

Types of

IS

Operator (RTTI)

label

statement

Library

Program structure

Message

Directive (method)

MOD

Operator (mathematics)

Name

Directive (function)

Near

Backward compatibility (class)

NIL

Numerical value

Nodefault

Directive (attribute)

NOT

Operator (Boole)

Object

Backward compatibility (class)

Of

Statement (CASE)

on

Statement (exception handling)

oral

Operator (Boole)

OUT

Directive (parameter)

Overload

Function instruction

Override

Function instruction

Package

Program structure (control package)

packed

Directive (record)

Pascal

Function call protocol

Private

Access class (Class)

Procedure

statement

PROGRAM

Program structure

Property

statement

protected

Access class (class)

public

Access class (class)

Published

Access class (class)

Raise

Statement (exception handling)

reta

Attribute category

Readonly

Dispatch interface category

Record

Types of

Register

Function call protocol

Reintroduce

Function instruction

Repeat

Statement

Requires

Program structure (control package)

Resident

Directive (function)

ResourceString

Types of

SafeCall

Function call protocol

set

Types of

SHL

Operator (mathematics)

SHR

Operator (mathematics)

Stdcall

Function call protocol

stored

Directive (attribute)

String

Types of

THEN

Statement (IF)

Threadvar

statement

TO

Statement (for)

Try

Statement (exception handling)

Type

statement

Unit

Unit structure

Until

Statement

Uses

Unit structure

VAR

statement

Virtual

Directive (method)

While

Statement

WITH

Statement

Write

Attribute category

Writeonly

Dispatch interface category

xor

Operator (Boole)

Operator priority table

Single operator (highest priority)

@

Take the address of variables or functions (return a pointer)

NOT

Logical reckless or pressing

Ride and bit position operators

*

Multiplication or collection

/

Floating point

Div

Integer

MOD

Taking the mold (the remainder of the integer)

AS

Program Running Phase Type Conversion (RTTI Operator)

and

Logic or pressing and

SHL

Displacement

SHR

Press-to-right shift

Add or subtract operator

Add, set, set, string connection, or pointer add an offset

-

Simble, set difference set or pointer to reduce an offset

oral

Logic or standing or operation

xor

Logic or component differentiation or operation

Relationship and comparison operator (minimum priority)

=

Determine if it is equal

<>

Determine if it is not equal

<

Determine if it is less than

>

Is it greater than

<=

Determine if it is less than or equal to, or is a set of subsets

> =

Determine if it is greater than or equal to, or is a collection of parent

in

Judging whether it is a collection member

IS

Judging whether the object is type compatible (another RTTI operator)

转载请注明原文地址:https://www.9cbs.com/read-119486.html

New Post(0)