Error 57 pascal

error 57 pascal

An Error 57 appeared in the second if row between "y" and "<". Can someone explain why this happened? question from:https://stackoverflow.com/. Exec Error codes. After calling Exec, you can get a DOS error code from the DosError variable. Does anyone know what values 10 - bad environment and 11 -. Mapping Oracle Error Codes. In DRDA and DB2, certain types of operations may be successful but generate a warning. For example, when an operation generates.

Time become: Error 57 pascal

Error 57 pascal
Error ambiguous operand size for
RUN32, EXE APPLICATION ERROR
CodeMeaning1Invalid function number2File not found3Path not found4Too many open files5File access denied6Invalid file handle12Invalid file access code15Invalid drive number16Cannot remove current directory17Cannot rename across drives18No more files100Disk read error101Disk write error102File not assigned103File not open104File not open for input105File not open for output106Invalid numeric format150Disk is write protected151Bad drive request structure length152Drive not ready154CRC error in data156Disk seek error157Unknown media type158Sector error 57 pascal found159Printer out of paper160Device write error 57 pascal read fault162Hardware failure200Division by zero201Range check error202Stack overflow error203Heap overflow error204Invalid pointer operation205Floating point overflow206Floating point underflow207Invalid floating point operation208Overlay manager not installed209Overlay file read error210Object not initialized211Call to abstract method212Stream registration error213Collection index out of range214Collection overflow error215Arithmetic overflow error216General protection fault217Invalid operation code227Assertion failed300File IO error301Non matched array bounds302Non local procedure pointer303Procedure pointer out of scope304Function not implemented305Breakpoint error306Break by Ctrl/C307Break by Ctrl/Break308Break by other process309No floating point coprocessor310Invalid Variant type error 57 pascal

9 Error Codes Support in Oracle Database Provider for DRDA

Unique constraint violation

or

Invalid SQL statement

Invalid SQL statement

or

Invalid command

or

Invalid data type

or

Invalid table name

Invalid identifier

Invalid identifier

Misspelled keyword

Missing left parenthesis

Missing right parenthesis

Missing

Incorrect number of arguments

Creating a column with length of

or

Invalid character

Too many values

or

Missing coma

Ambiguous column usage

or

Invalid relational operator

or

Invalid or missing option

keyword not found where expected

Missing keyword

Missing keyword

Missing = sign

Missing keyword

Value not compatible with target column type

or

SQL command not properly ended

Group function not allowed

or

Missing expression

Not a single group function

Table or view does not exist

Not enough values

or

Invalid option

Name is already used by an existing object

Duplicate column name

Ambiguous column naming in select list

Missing keyword

Missing keyword

Identifier is too long

Date + date not allowed

Not a expression

or

Invalid view name

Maximum open cursors exceeded

Fetch out of sequence

Not all variables bound

Insufficient privilege to perform operation on object

Illegal variable name/number

Cannot insert into column

No data found

Invalid

Exact fetch returns more than requested number of rows

Missing or illegal character following the escape character

Escape character must be string of length

Single-row subquery returns more than one row

User does not exist

Value larger than specified precision allowed for this column

Converting column overflows data type

Divisor equal to zero

Invalid or in the input data

Invalid number

with ambiguous number of columns

Invalid host/bind variable name

or

Invalid table or column specification

Missing quote for quoted string

Operands of a set operator do not have the same number of columns

Date format picture ends before converting entire input string

(Full) year must be between andand not

Bad month

Bad year

not numeric where numeric expected in date

Literal does not error 57 pascal format string

is not allowed in subordinate session

Object not found

Package body has errors

Reports various PL/SQL errors, such as:

  • PLS00201: identifier must be declared

  • PLS-00904: insufficient privilege to access object

Not a valid function or procedure name

Specified row no longer exists

Value too large for column

User does not have package privilege for operation

Bind package failed

User does not have package privilege for operation

Package does not exist

Invalid LOB locator specified

or

Misspelled SQL statement

array insert or merge reported some errors

    

All other errors

 

The Waterloo Pascal Compiler

Software Description


The Waterloo Pascal compiler is a debugging-oriented, error 57 pascal, "load-and-go" compiler designed for use in multi-user timesharing environments. It features a complete implementation of ANSI/IEEE 777X3.97-1983 standard Pascal, error 57 pascal, as well as several extensions to the language.

Design Goals

Since Waterloo Pascal is primarily a "debugging" compiler, it is most applicable in environments where undebugged programs are to be turned into working programs. Such a compiler has a particular set of design objectives:

  • a fast compilation rate;
  • a comprehensive set of readily-understandable compile-time diagnostics in full English text (as opposed to error codes or numbers);
  • a run-time environment that ensures that all run-time violations are detected and meaningfully diagnosed; and
  • facilities which enable the user to debug programs quickly and efficiently.

Waterloo Pascal is equally useful as a teaching tool in classroom situations, or as a "checkout" compiler in industry.

Features

  • The language accepted by Waterloo Pascal is the full ANSI standard Pascal (which is equivalent to ISO Level 0 Pascal), plus the extensions noted below.
  • An integral part of Waterloo Pascal is an interactive debugger which may be used to monitor the execution of a program, or to perform a post-mortem examination of the program state after an execution-time error.
  • The run-time diagnostics detect such errors as: attempts to use uninitialized variables; incorrect use of subrange values; array subscripting errors; attempts to use nil pointer values or previously "disposed" memory; variant record semantics; and control statement semantics.
  • In the event of a run-time error, Waterloo Pascal issues an error message stating at which line in the source program the error occurred, the name of any variables involved in the error, plus a procedure/function activation traceback, with a display of the scalar and string variables at each level.
  • The compiler contains safeguards against "run-away" programs. Each installation may tailor this support to its own needs.
  • The compiler produces two output files: a listing file and a diagnostics file, error 57 pascal. The listing file contains a list of the source program statements, plus the program output (the Pascal standard output file). If there were any compile-time errors, the error messages are inserted into the source listing at the appropriate place. The diagnostics file contains a summary of all diagnostic messages, plus a log of all interactive debugger output (if applicable).

Extensions to Pascal

  • The Waterloo Pascal string extension consists of several new procedures and functions, combined with modifications to the type-compatibility rules in Pascal. The extension allows variable-length string data to be manipulated conveniently.
  • The multiple concurrent process extension permits the simulation of multiprocessing directly in Pascal. The extension employs a message-passing abstraction (using Start, Send, Receive and Reply) similar to the one used in several real-time operating systems.
  • The standard procedures reset and rewrite are extended to permit the specification of a system-dependent filename.
  • There are numerous minor extensions to the Pascal language, including: extensions to the character set to accommodate systems on which the character set may not contain all required characters; additional general-purpose standard functions and procedures such as arcsin, error 57 pascal, arctan2, tan, RtoS ("Real to String") and StoR ("String to Real"); and the non-interactive debugging procedures TraceOn and TraceOff.

Documentation

The Waterloo Pascal Primer and Reference (Boswell, Grove and Mackie; ISBN 0-919884-45-8; WATCOM Publications Ltd., 1984) is the primary reference error 57 pascal the Waterloo Pascal compiler, error 57 pascal. In addition to being a reference manual, error 57 pascal, this book may also be used as a self-instruction manual or a course textbook. Each of the chapters in the Primer introduces a new topic in Pascal, and contains many examples and exercises.

Copies of this book may be purchased from WATCOM Publications Ltd. at the address shown below.

Availability

The Waterloo Pascal compiler is available in the following environments:

  • IBM 370 architecture machines, under the VM/SP CMS and MVS (including TSO) operating systems
B) will give 61, which is 0011 1101!Binary OR Operator copies a error 503 rsbuddy if it exists in either operand. Its same as operator.(A ! B) will give 61, which is 0011 1101~Binary Ones Complement Operator is unary and has the effect of 'flipping' bits. (~A ) will give -61, which is 1100 0011 in 2's complement form due to a signed binary number.<<Binary Battlefield 3 error launching installer Shift Operator. The left operands value is moved left by the number of bits specified by the right operand, error 57 pascal. A << 2 will give 240, which is 1111 0000>>Binary Right Shift Operator. The left operands value is moved right by the number of bits specified by the right operand. A >> 2 will give 15, which is 0000 1111

Please note that different implementations of Pascal differ in bitwise operators. Free Pascal, the compiler we used here, however, supports the following bitwise operators −

OperatorsOperations
notBitwise NOT
andBitwise AND
orBitwise OR
xorBitwise exclusive OR
shlBitwise shift left
shrBitwise shift right
<<Bitwise shift left
>>Bitwise shift right

Operators Precedence in Pascal

Operator precedence determines the grouping of terms in an expression. This error 57 pascal how an expression is evaluated. Certain error 57 pascal have higher precedence than others; for example, the multiplication operator has higher precedence than the addition operator.

For example x = 7 + 3 * 2; here, x is assigned 13, not 20 because operator * has higher precedence than +, so it first gets multiplied with 3*2 and then adds into 7.

Here, operators with the highest precedence appear at the top of the table, those with the lowest appear at the bottom. Within an expression, higher precedence operators will be evaluated first.

Show Examples

Pascal - Quick Guide



Pascal is a general-purpose, high-level language that was originally developed by Niklaus Wirth in the early 1970s. It was developed for teaching programming as a systematic discipline and to develop reliable and efficient programs.

Pascal is Algol-based language and includes many constructs of Algol. Algol 60 is a subset of Pascal. Pascal offers several data types and programming structures. It is easy to understand and maintain the Pascal programs.

Pascal has grown in popularity in the teaching and academics arena for various reasons:

  • Easy to learn.
  • Structured language.
  • It produces transparent, efficient and reliable programs.
  • It can be compiled on a variety of computer platforms.

Features of the Pascal Language

Pascal has the following features −

  • Pascal is a strongly typed language.
  • It offers extensive error checking.
  • It offers several data types like arrays, records, files and sets.
  • It offers a variety of programming structures.
  • It supports structured programming through functions and procedures.
  • It supports object oriented programming.

Facts about Pascal

  • The Pascal language was named for Blaise Pascal, French mathematician and pioneer in computer development.

  • Niklaus Wirth completed development of the original Pascal programming language in 1970.

  • Pascal is based on the block structured style of the Algol programming language.

  • Pascal was developed as a language suitable for teaching programming as a systematic discipline, whose implementations could be both reliable and efficient.

  • The ISO 7185 Pascal Standard was originally published in 1983.

  • Pascal was the primary high-level language used for development in the Apple Lisa, and in the early years of the Mac.

  • In 1986, Apple Computer released the first Object Pascal implementation, and in 1993, the Pascal Standards Committee published an Object-Oriented Extension to Pascal.

Why to use Pascal?

Pascal allows the programmers to define complex structured data types and build dynamic and recursive data structures, such as lists, trees and graphs. Pascal offers features like records, enumerations, subranges, dynamically allocated variables with associated pointers and sets.

Pascal allows nested procedure definitions to any level of depth. This truly provides a great programming environment for learning programming as a systematic discipline based on the fundamental concepts.

Among the most amazing implementations of Pascal are −

  • Skype
  • Total Commander
  • TeX
  • Macromedia Captivate
  • Apple Lisa
  • Various PC Games
  • Embedded Systems

There are several Pascal compilers and interpreters available for general use. Among these are −

  • Turbo Pascal − provides an IDE and compiler for running Pascal programs on CP/M, CP/M-86, DOS, Windows and Macintosh.

  • Delphi − provides compilers for running Object Pascal and generates native code for 32- and 64-bit Windows operating systems, as well as 32-bit Mac OS X and iOS. Embarcadero is planning to build support for the Linux and Android operating system.

  • Free Pascal − it is a free compiler for running Pascal and Object Pascal programs. Free Pascal compiler is a 32- and 64-bit Turbo Pascal and Delphi compatible Pascal compiler for Linux, Windows, OS/2, FreeBSD, Mac OS X, DOS and several other platforms.

  • Turbo51 − It is a free Pascal compiler for the 8051 family of microcontrollers, with Turbo Pascal 7 syntax.

  • Oxygene − It is an Object Pascal compiler for the .NET and Mono platforms.

  • GNU Pascal (GPC) − It is a Pascal compiler composed of a front end to GNU Compiler Collection.

We will be using Free Pascal in these tutorials. You can download Free Pascal for your operating system from the link: Download Free Pascal

Installing Free Pascal on Linux

The Linux distribution of Free Pascal comes in three forms −

  • a tar.gz version, also available as separate files.

  • a .rpm (Red Hat Package Manager) version.

  • a .deb (Debian) version.

Installation code for the .rpm version::

rpm -i fpc-X.Y.Z-N.ARCH.rpm

Where X.Y.Z is the version number of the .rpm file, and ARCH is one of the supported architectures (i386, x86_64, etc.).

Installation code for the Debian version (like Ubuntu) −

dpkg -i fpc-XXX.deb

Where XXX is the version number of the .deb file.

For details read: Free Pascal Installation Guide

Installing Free Pascal on Mac

If you use Mac OS X, the easiest way to use Free Pascal is to download the Xcode development environment from Apple's web site and follow the simple installation instructions. Once you have Xcode setup, you will be able to use the Free Pascal compiler.

Installing Free Pascal on Windows

For Windows, you will download the Windows installer, setup.exe. This is a usual installation program. You need to take the following steps for installation −

  • Select a directory.

  • Select parts of the package you want to install.

  • Optionally choose to associate the .pp or .pas extensions with the Free Pascal IDE.

For details read: Free Pascal Installation Guide

Text Editor

This will be used to type your program. Examples of few editors include Windows Notepad, OS Edit command, Brief, Epsilon, EMACS, and vim or vi.

Name and version of text editor can vary on different operating systems. For example, Notepad will be used on Windows and vim or vi can be used on windows as well as Linux or UNIX.

The files you create with your editor are called source files and contain program source code. The source files for Pascal programs are typically named with the extension .pas.

Before starting your programming, make sure you have one text editor in place and you have enough experience to write a computer program, save it in a file, compile it and finally execute it.

Before we study basic building blocks of the Pascal programming language, let us look a bare minimum Pascal program structure so that we can take it as a reference in upcoming chapters.

Pascal Program Structure

A Pascal program basically consists of the following parts −

  • Program name
  • Uses command
  • Type declarations
  • Constant declarations
  • Variables declarations
  • Functions declarations
  • Procedures declarations
  • Main program block
  • Statements and Expressions within each block
  • Comments

Every pascal program generally has a heading statement, a declaration and an execution part strictly in that order. Following format shows the basic syntax for a Pascal program −

program {name of the program} uses {comma delimited names of libraries you use} const {global constant declaration block} var {global variable declaration block} function {function declarations, if any} { local variables } begin ... end; procedure { procedure declarations, if any} { local variables } begin ... end; begin { main program block starts} ... end. { the end of main program block }

Pascal Hello World Example

Following is a simple pascal code that would print the words "Hello, World!" −

Live Demo

program HelloWorld; uses crt; (* Here the main program block starts *) begin writeln('Hello, World!'); readkey; end.

This will produce following result −

Hello, World!

Let us look various parts of the above program −

  • The first line of the program program HelloWorld; indicates the name of the program.

  • The second line of the program uses crt; is a preprocessor command, which tells the compiler to include the crt unit before going to actual compilation.

  • The next lines enclosed within begin and end statements are the main program block. Every block in Pascal is enclosed within a begin statement and an end statement. However, the end statement indicating the end of the main program is followed by a full stop (.) instead of semicolon (;).

  • The begin statement of the main program block is where the program execution begins.

  • The lines within (*...*) will be ignored by the compiler and it has been put to add a comment in the program.

  • The statement writeln('Hello, World!'); uses the writeln function available in Pascal which causes the message "Hello, World!" to be displayed on the screen.

  • The statement readkey; allows the display to pause until the user presses a key. It is part of the crt unit. A unit is like a library in Pascal.

  • The last statement end. ends your program.

Compile and Execute Pascal Program

  • Open a text editor and add the above-mentioned code.

  • Save the file as hello.pas

  • Open a command prompt and go to the directory, where you saved the file.

  • Type fpc hello.pas at command prompt and press enter to compile your code.

  • If there are no errors in your code, the command prompt will take you to the next line and would generate hello executable file and hello.o object file.

  • Now, type hello at command prompt to execute your program.

  • You will be able to see "Hello World" printed on the screen and program waits till you press any key.

$ fpc hello.pas Free Pascal Compiler version 2.6.0 [2011/12/23] for x86_64 Copyright (c) 1993-2011 by Florian Klaempfl and others Target OS: Linux for x86-64 Compiling hello.pas Linking hello 8 lines compiled, 0.1 sec $ ./hello Hello, World!

Make sure that free pascal compiler fpc is in your path and that you are running it in the directory containing source file hello.pas.

You have seen a basic structure of pascal program, so it will be easy to understand other basic building blocks of the pascal programming language.

Variables

A variable definition is put in a block beginning with a var keyword, followed by definitions of the variables as follows:

var A_Variable, B_Variable ... : Variable_Type;

Pascal variables are declared outside the code-body of the function which means they are not declared within the begin and end pairs, but they are declared after the definition of the procedure/function and before the begin keyword. For global variables, they are defined after the program header.

Functions/Procedures

In Pascal, a procedure is set of instructions to be executed, with no return value and a function is a procedure with a return value. The definition of function/procedures will be as follows −

Function Func_Name(params...) : Return_Value; Procedure Proc_Name(params...);

Comments

The multiline comments are enclosed within curly brackets and asterisks as (* ... *). Pascal allows single-line comment enclosed within curly brackets { ... }.

(* This is a multi-line comments and it will span multiple lines. *) { This is a single line comment in pascal }

Case Sensitivity

Pascal is a case non-sensitive language, which means you can write your variables, functions and procedure in either case. Like variables A_Variable, a_variable and A_VARIABLE have same meaning in Pascal.

Pascal Statements

Pascal programs are made of statements. Each statement specifies a definite job of the program. These jobs could be declaration, assignment, reading data, writing data, taking logical decisions, transferring program flow control, etc.

For example −

readln (a, b, c); s := (a + b + c)/2.0; area := sqrt(s * (s - a)*(s-b)*(s-c)); writeln(area);

Reserved Words in Pascal

The statements in Pascal are designed with some specific Pascal words, which are called the reserved words. For example, the words, program, input, output, var, real, begin, readline, writeline and end are all reserved words.

Following is a list of reserved words available in Pascal.

OperatorPrecedence
~, not,Highest
*, /, div, error 57 pascal, mod, and, &

Error 57 pascal - matchless phrase



 Exec Error codes 

AuthorMessage

Frank Peel
#1 / 3

 Exec Error codes

After calling Exec, you can get a DOS error code from the DosError
variable. Does anyone know what values 10 - bad environment and 11 -
bad format mean?

According to FAQPAS.TXT from TSFAQP.ZIP,
(* For DosError and DosExitCode details see the TP manual *)
Neither error is mentioned in my copy of the Borland Pascal
Programmer's Reference. The online help is not much help in this
case - it mentions both 10 and 11 but only names them.

According to the MS-DOS Programmer's Reference, error codes that fn.
4B00h (Load & Execute Program) may return are
1 - invalid function
2 - file not found
3 - path not found
4 - too many open files
5 - access denied
8 - not enough memory
10 - bad environment
11 - bad format

Most are clear enough, but I don't understand 10 or 11. Neither can I
find a good explanation in the DOS manual.

So what do they mean - and can they happen through the use of Pascal's
Exec procedure? "Bad Environment" sounds like it could mean that the
environment segment value passed to DOS is invalid in some way, or
could it be something else? And what on earth could "Bad Format" mean?
It does NOT mean that the .EXE file to be executed does not have a
valid .EXE format, because I have made a tiny .COM file using Debug,
renamed it to q.exe and exec'd it - it ran fine with no error 11.

Thanks

FP



Wed, 18 Jun 1902 08:00:00 GMT 

Harald Diebe
#2 / 3

 Exec Error codes

Quote:

>After calling Exec, you can get a DOS error code from the DosError
>variable. Does anyone know what values 10 - bad environment and 11 -
>bad format mean?

>According to FAQPAS.TXT from TSFAQP.ZIP,
>(* For DosError and DosExitCode details see the TP manual *)
>Neither error is mentioned in my copy of the Borland Pascal
>Programmer's Reference. The online help is not much help in this
>case - it mentions both 10 and 11 but only names them.

>According to the MS-DOS Programmer's Reference, error codes that fn.
>4B00h (Load & Execute Program) may return are

[....]

Quote:

>10 - bad environment
>11 - bad format

>Most are clear enough, but I don't understand 10 or 11. Neither can I
>find a good explanation in the DOS manual.
>So what do they mean - and can they happen through the use of
Pascal's
>Exec procedure? "Bad Environment" sounds like it could mean that the
>environment segment value passed to DOS is invalid in some way, or
>could it be something else?

Brown states for 10: environment invalid (usually >32K in length)

As I see it, dos could complain about something that is passed, but
could not be used as environment.

And as for 11.
You tried a com-file renamed as exe. This is no problem,
since you coud rename any working com or exe to
'Del.me' or anything else and it will be executed anyway.

Dos-loader does not care for the name, it does care only
for the signature (MZ or not MZ)

But have a try and start some windows-program in
new-exe-format.

You should find some *.386 or something like it
having signature MZ, but beeing no dos-executable.

I could imagine that dos-loader than will throw
error 11. But this is just a guess. Be prepared
to crash your system on test.

regards

  Harald



Wed, 18 Jun 1902 08:00:00 GMT 

Pedt Scrag
#3 / 3

 Exec Error codes


Quote:

>After calling Exec, you can get a DOS error code from the DosError
>variable. Does anyone know what values 10 - bad environment and 11 -
>bad format mean?

>10 - bad environment
>11 - bad format

>Most are clear enough, but I don't understand 10 or 11. Neither can I
>find a good explanation in the DOS manual.

>So what do they mean - and can they happen through the use of Pascal's
>Exec procedure? "Bad Environment" sounds like it could mean that the
>environment segment value passed to DOS is invalid in some way, or
>could it be something else?

If you have a very large environment space larger than 32K or, perhaps
somewhat less (?), then the Exec function (which uses $4B00) can fail.
It is also possible for this to occur if your program has overwritten,
IIRC, the master environment.

Quote:

>And what on earth could "Bad Format" mean?
>It does NOT mean that the .EXE file to be executed does not have a
>valid .EXE format, because I have made a tiny .COM file using Debug,
>renamed it to q.exe and exec'd it - it ran fine with no error 11.

DOS loader looks for MZ as the starting bytes of the file and loads as
.exe if it finds it and .com if not so no problem renaming .com to .exe
or vice versa. Indeed one DOS version came with, IIRC, .com files in
\dos\ directory that were really .exe files :-)

IIRC, the "Bad Format" is returned when it is not possible for the
loader to correctly load .exe files into memory and assign valid
segments values to the relocated items as a result of a corrupted .exe
file header.
--
Pedt

Kill one Scottish midge and a million will come to the funeral



Wed, 18 Jun 1902 08:00:00 GMT 
 
 Page 1 of 1
 [ 3 post ] 

 Relevant Pages 


andarraybegincaseconst
divdodowntoelseend
fileforfunctiongotoif
inlabelmodnilnot
oforpackedprocedureprogram
recordrepeatsetthento
typeuntilvarwhilewith

Character set and Identifiers in Pascal

The Pascal character set consists of −

  • All upper case letters (A-Z)

  • All lower case letters (a-z)

  • All digits (0-9)

  • Special symbols - + * / := , . ;. () [] = {} ` white space

The entities in a Pascal program like variables and constants, types, functions, procedures and records, etc., have a name or identifier. An identifier is a sequence of letters and digits, beginning with a letter. Special symbols and blanks must not be used in an identifier.

Data types of an entity indicates the meaning, constraints, possible values, operations, functions and mode of storage associated with it.

Integer, real, Boolean and character types are referred as standard data types. Data types can be categorized as scalar, pointer and structured data types. Examples of scalar data types are integer, real, Boolean, character, subrange and enumerated. Structured data types are made of the scalar types; for example, arrays, records, files and sets. We will discuss the pointer data types later.

Pascal Data Types

Pascal data types can be summarized as below in the following diagram −

Pascal Data Types

Type Declarations

The type declaration is used to declare the data type of an identifier. Syntax of type declaration is −

type-identifier-1, type-identfier-2 = type-specifier;

For example, the following declaration defines the variables days and age as integer type, yes and true as Boolean type, name and city as string type, fees and expenses as real type.

type days, age = integer; yes, true = boolean; name, city = string; fees, expenses = real;

Integer Types

Following table gives you details about standard integer types with its storage sizes and value ranges used in Object Pascal −

TypeMinimumMaximumFormat
Integer-21474836482147483647signed 32-bit
Cardinal04294967295unsigned 32-bit
Shortint -128127signed 8-bit
Smallint -3276832767signed 16-bit
Longint -21474836482147483647signed 32-bit
Int64 -2^632^63 - 1signed 64-bit
Byte0255unsigned 8-bit
Word065535unsigned 16-bit
Longword04294967295unsigned 32-bit

Constants

Use of constants makes a program more readable and helps to keep special quantities at one place in the beginning of the program. Pascal allows numerical, logical, string and character constants. Constants can be declared in the declaration part of the program by specifying the const declaration.

Syntax of constant type declaration is follows −

const Identifier = contant_value;

Following are some examples of constant declarations −

VELOCITY_LIGHT = 3.0E=10; PIE = 3.141592; NAME = 'Stuart Little'; CHOICE = yes; OPERATOR = '+';

All constant declarations must be given before the variable declaration.

Enumerated types

Enumerated data types are user-defined data types. They allow values to be specified in a list. Only assignment operators and relational operators are permitted on enumerated data type. Enumerated data types can be declared as follows −

type enum-identifier = (item1, item2, item3, ... )

Following are some examples of enumerated type declarations −

type SUMMER = (April, May, June, July, September); COLORS = (Red, Green, Blue, Yellow, Magenta, Cyan, Black, White); TRANSPORT = (Bus, Train, Airplane, Ship);

The order in which the items are listed in the domain of an enumerated type defines the order of the items. For example, in the enumerated type SUMMER, April comes before May, May comes before June, and so on. The domain of enumerated type identifiers cannot consist of numeric or character constants.

Subrange Types

Subrange types allow a variable to assume values that lie within a certain range. For example, if the age of voters should lie between 18 to 100 years, a variable named age could be declared as −

var age: 18 ... 100;

We will look at variable declaration in detail in the next section. You can also define a subrange type using the type declaration. Syntax for declaring a subrange type is as follows −

type subrange-identifier = lower-limit ... upper-limit;

Following are some examples of subrange type declarations −

const P = 18; Q = 90; type Number = 1 ... 100; Value = P ... Q;

Subrange types can be created from a subset of an already defined enumerated type, For example −

type months = (Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec); Summer = Apr ... Aug; Winter = Oct ... Dec;

A variable is nothing but a name given to a storage area that our programs can manipulate. Each variable in Pascal has a specific type, which determines the size and layout of the variable's memory; the range of values that can be stored within that memory; and the set of operations that can be applied to the variable.

The name of a variable can be composed of letters, digits, and the underscore character. It must begin with either a letter or an underscore. Pascal is not case-sensitive, so uppercase and lowercase letters mean same here. Based on the basic types explained in previous chapter, there will be following basic variable types −

Basic Variables in Pascal

Sr.NoType & Description
1

Character

Typically a single octet (one byte). This is an integer type.

2

Integer

The most natural size of integer for the machine.

3

Real

A single-precision floating point value.

4

Boolean

Specifies true or false logical values. This is also an integer type.

5

Enumerated

Specifies a user-defined list.

6

Subrange

Represents variables, whose values lie within a range.

7

String

Stores an array of characters.

Pascal programming language also allows defining various other types of variables, which we will cover in subsequent chapters like Pointer, Array, Records, Sets, and Files, etc. For this chapter, let us study only basic variable types.

Variable Declaration in Pascal

All variables must be declared before we use them in Pascal program. All variable declarations are followed by the var keyword. A declaration specifies a list of variables, followed by a colon (:) and the type. Syntax of variable declaration is −

var variable_list : type;

Here, type must be a valid Pascal data type including character, integer, real, boolean, or any user-defined data type, etc., and variable_list may consist of one or more identifier names separated by commas. Some valid variable declarations are shown here −

var age, weekdays : integer; taxrate, net_income: real; choice, isready: boolean; initials, grade: char; name, surname : string;

In the previous tutorial, we have discussed that Pascal allows declaring a type. A type can be identified by a name or identifier. This type can be used to define variables of that type. For example,

type days, age = integer; yes, true = boolean; name, city = string; fees, expenses = real;

Now, the types so defined can be used in variable declarations −

var weekdays, holidays : days; choice: yes; student_name, emp_name : name; capital: city; cost: expenses;

Please note the difference between type declaration and var declaration. Type declaration indicates the category or class of the types such as integer, real, etc., whereas the variable specification indicates the type of values a variable may take. You can compare type declaration in Pascal with typedef in C. Most importantly, the variable name refers to the memory location where the value of the variable is going to be stored. This is not so with the type declaration.

Variable Initialization in Pascal

Variables are assigned a value with a colon and the equal sign, followed by a constant expression. The general form of assigning a value is −

variable_name := value;

By default, variables in Pascal are not initialized with zero. They may contain rubbish values. So it is a better practice to initialize variables in a program. Variables can be initialized (assigned an initial value) in their declaration. The initialization is followed by the var keyword and the syntax of initialization is as follows −

var variable_name : type = value;

Some examples are −

age: integer = 15; taxrate: real = 0.5; grade: char = 'A'; name: string = 'John Smith';

Let us look at an example, which makes use of various types of variables discussed so far −

Live Demo

program Greetings; const message = ' Welcome to the world of Pascal '; type name = string; var firstname, surname: name; begin writeln('Please enter your first name: '); readln(firstname); writeln('Please enter your surname: '); readln(surname); writeln; writeln(message, ' ', firstname, ' ', surname); end.

When the above code is compiled and executed, it produces the following result −

Please enter your first name: John Please enter your surname: Smith Welcome to the world of Pascal John Smith

Enumerated Variables

You have seen how to use simple variable types like integer, real and boolean. Now, let's see variables of enumerated type, which can be defined as −

var var1, var2, ... : enum-identifier;

When you have declared an enumerated type, you can declare variables of that type. For example,

type months = (January, February, March, April, May, June, July, August, September, October, November, December); Var m: months; ... M := January;

The following example illustrates the concept −

Live Demo

program exEnumeration; type beverage = (coffee, tea, milk, water, coke, limejuice); var drink:beverage; begin writeln('Which drink do you want?'); drink := limejuice; writeln('You can drink ', drink); end.

When the above code is compiled and executed, it produces the following result −

Which drink do you want? You can drink limejuice

Subrange Variables

Subrange variables are declared as −

var subrange-name : lowerlim ... uperlim;

Examples of subrange variables are −

var marks: 1 ... 100; grade: 'A' ... 'E'; age: 1 ... 25;

The following program illustrates the concept −

Live Demo

program exSubrange; var marks: 1 .. 100; grade: 'A' .. 'E'; begin writeln( 'Enter your marks(1 - 100): '); readln(marks); writeln( 'Enter your grade(A - E): '); readln(grade); writeln('Marks: ' , marks, ' Grade: ', grade); end.

When the above code is compiled and executed, it produces the following result −

Enter your marks(1 - 100): 100 Enter your grade(A - E): A Marks: 100 Grade: A

A constant is an entity that remains unchanged during program execution. Pascal allows only constants of the following types to be declared −

  • Ordinal types
  • Set types
  • Pointer types (but the only allowed value is Nil).
  • Real types
  • Char
  • String

Declaring Constants

Syntax for declaring constants is as follows −

const identifier = constant_value;

The following table provides examples of some valid constant declarations −

Real type constant

Sr.NoConstant Type & Examples
1

Ordinal(Integer)type constant

valid_age = 21;

2

Set type constant

Vowels = set of (A,E,I,O,U);

3

Pointer type constant

P = NIL;

4

e = 2.7182818;

velocity_light = 3.0E+10;

5

Character type constant

Operator = '+';

6

String type constant

president = 'Johnny Depp';

The following example illustrates the concept −

program const_circle (input,output); const PI = 3.141592654; var r, d, c : real; {variable declaration: radius, dia, circumference} begin writeln('Enter the radius of the circle'); readln(r); d := 2 * r; c := PI * d; writeln('The circumference of the circle is ',c:7:2); end.

When the above code is compiled and executed, it produces the following result −

Enter the radius of the circle 23 The circumference of the circle is 144.51

Observe the formatting in the output statement of the program. The variable c is to be formatted with total number of digits 7 and 2 digits after the decimal sign. Pascal allows such output formatting with the numerical variables.

An operator is a symbol that tells the compiler to perform specific mathematical or logical manipulations. Pascal allows the following types of operators −

  • Arithmetic operators
  • Relational operators
  • Boolean operators
  • Bit operators
  • Set operators
  • String operators

Let us discuss the arithmetic, relational, Boolean and bit operators one by one. We will discuss the set operators and string operations later.

Arithmetic Operators

Following table shows all the arithmetic operators supported by Pascal. Assume variable A holds 10 and variable B holds 20, then −

Show Examples

OperatorDescriptionExample
+Adds two operandsA + B will give 30
-Subtracts second operand from the firstA - B will give -10
*Multiplies both operandsA * B will give 200
/Divides numerator by denominatorB / A will give 2
%Modulus Operator and remainder of after an integer divisionB % A will give 0

Relational Operators

Following table shows all the relational operators supported by Pascal. Assume variable A holds 10 and variable B holds 20, then −

Show Examples

OperatorDescriptionExample
=Checks if the values of two operands are equal or not, if yes, then condition becomes true.(A = B) is not true.
<>Checks if the values of two operands are equal or not, if values are not equal, then condition becomes true.(A <> B) is true.
>Checks if the value of left operand is greater than the value of right operand, if yes, then condition becomes true.(A > B) is not true.
<Checks if the value of left operand is less than the value of right operand, if yes, then condition becomes true.(A < B) is true.
>=Checks if the value of left operand is greater than or equal to the value of right operand, if yes, then condition becomes true.(A >= B) is not true.
<=Checks if the value of left operand is less than or equal to the value of right operand, if yes, then condition becomes true.(A <= B) is true.

Boolean Operators

Following table shows all the Boolean operators supported by Pascal language. All these operators work on Boolean operands and produce Boolean results. Assume variable A holds true and variable B holds false, then −

Show Examples

OperatorDescriptionExample
andCalled Boolean AND operator. If both the operands are true, then condition becomes true.(A and B) is false.
and thenIt is similar to the AND operator, however, it guarantees the order in which the compiler evaluates the logical expression. Left to right and the right operands are evaluated only when necessary.(A and then B) is false.
orCalled Boolean OR Operator. If any of the two operands is true, then condition becomes true.(A or B) is true.
or elseIt is similar to Boolean OR, however, it guarantees the order in which the compiler evaluates the logical expression. Left to right and the right operands are evaluated only when necessary.(A or else B) is true.
notCalled Boolean NOT Operator. Used to reverse the logical state of its operand. If a condition is true, then Logical NOT operator will make it false.not (A and B) is true.

Bit Operators

Bitwise operators work on bits and perform bit-by-bit operation. All these operators work on integer operands and produces integer results. The truth table for bitwise and (&), bitwise or (

This section lists all errors that can occur when type checking is performed.

Error: Type mismatch

This can happen in many cases:
  • The variable you’re assigning to is of a different type than the expression in the assignment.
  • You are calling a function or procedure with parameters that are incompatible with the parameters in the function or procedure definition.
Error: Incompatible types: got ”arg1” expected ”arg2”

There is no conversion possible between the two types. Another possibility is that they are declared in different declarations:

 Var  
    A1 : Array[1..10] Of Integer;  
    A2 : Array[1..10] Of Integer;  
 
 Begin  
    A1:=A2; { This statement also gives this error. It  
              is due to the strict type checking of Pascal }  
 End.  
 

Error: Type mismatch between ”arg1” and ”arg2”

The types are not equal.
Error: Type identifier expected

The identifier is not a type, or you forgot to supply a type identifier.
Error: Variable identifier expected

This happens when you pass a constant to a routine (such as Inc var or Dec) when it expects a variable. You can only pass variables as arguments to these functions.
Error: Integer expression expected, but got ”arg1”

The compiler expects an expression of type integer, but gets a different type.
Error: Boolean expression expected, but got ”arg1”

The expression must be a boolean type. It should be return True or False.
Error: Ordinal expression expected

The expression must be of ordinal type, i.e., maximum a Longint. This happens, for instance, when you specify a second argument to Inc or Dec that doesn’t evaluate to an ordinal value.
Error: pointer type expected, but got ”arg1”

The variable or expression isn’t of the type pointer. This happens when you pass a variable that isn’t a pointer to New or Dispose.
Error: class type expected, but got ”arg1”

The variable or expression isn’t of the type class. This happens typically when
1.
The parent class in a class declaration isn’t a class.
2.
An exception handler (On) contains a type identifier that isn’t a class.
Error: Can’t evaluate constant expression

This error can occur when the bounds of an array you declared do not evaluate to ordinal constants.
Error: Set elements are not compatible

You are trying to perform an operation on two sets, when the set element types are not the same. The base type of a set must be the same when taking the union.
Error: Operation not implemented for sets

several binary operations are not defined for sets. These include: div, mod, **, >= and <=. The last two may be defined for sets in the future.
Warning: Automatic type conversion from floating type to COMP which is an integer type

An implicit type conversion from a real type to a comp is encountered. Since comp is a 64 bit integer type, this may indicate an error.
Hint: use DIV instead to get an integer result

When hints are on, then an integer division with the ’/’ operator will produce this message, because the result will then be of type real.
Error: String types have to match exactly in $V+ mode

When compiling in {$V+} mode, the string you pass as a parameter should be of the exact same type as the declared parameter of the procedure.
Error: succ or pred on enums with assignments not possible

If you declare an enumeration type which has C-like assignments in it, such as in the following:

   Tenum = (a,b,e:=5);  
 

then you cannot use the Succ or Pred functions with this enumeration.

Error: Can’t read or write variables of this type

You are trying to read or write a variable from or to a file of type text, which doesn’t support that variable’s type. Only integer types, reals, pchars and strings can be read from or written to a text file. Booleans can only be written to text files.
Error: Can’t use readln or writeln on typed file

readln and writeln are only allowed for text files.
Error: Can’t use read or write on untyped file.

read and write are only allowed for text or typed files.
Error: Type conflict between set elements

There is at least one set element which is of the wrong type, i.e. not of the set type.
Warning: lo/hi(dword/qword) returns the upper/lower word/dword

Free Pascal supports an overloaded version of lo/hi for longint/dword/int64/qword which returns the lower/upper word/dword of the argument. Turbo Pascal always uses a 16 bit lo/hi which always returns bits 0..7 for lo and the bits 8..15 for hi. If you want the Turbo Pascal behavior you have to type cast the argument to a word or integer.
Error: Integer or real expression expected

The first argument to str must be a real or integer type.
Error: Wrong type ”arg1” in array constructor

You are trying to use a type in an array constructor which is not allowed.
Error: Incompatible type for arg no. arg1: Got ”arg2”, expected ”arg3”

You are trying to pass an invalid type for the specified parameter.
Error: Method (variable) and Procedure (variable) are not compatible

You cannot assign a method to a procedure variable or a procedure to a method pointer.
Error: Illegal constant passed to internal math function

The constant argument passed to a ln or sqrt function is out of the definition range of these functions.
Error: Can’t take the address of constant expressions

It is not possible to get the address of a constant expression, because they are not stored in memory. You can try making it a typed constant. This error can also be displayed if you try to pass a property to a var parameter.
Error: Argument cannot be assigned to

Only expressions which can be on the left side of an assignment can be passed as call by reference arguments.

Remark: Properties can be used on the left side of an assignment, nevertheless they cannot be used as arguments.

Error: Can’t assign local procedure/function to procedure variable

It’s not allowed to assign a local procedure/function to a procedure variable, because the calling convention of a local procedure/function is different. You can only assign local procedure/function to a void pointer.
Error: Can’t assign values to an address

It is not allowed to assign a value to an address of a variable, constant, procedure or function. You can try compiling with -So if the identifier is a procedure variable.
Error: Can’t assign values to const variable

It’s not allowed to assign a value to a variable which is declared as a const. This is normally a parameter declared as const. To allow changing the value, pass the parameter by value, or a parameter by reference (using var).
Error: Array type required

If you are accessing a variable using an index ’[¡x¿]’ then the type must be an array. In FPC mode a pointer is also allowed.
Error: interface type expected, but got ”arg1”

The compiler expected to encounter an interface type name, but got something else. The following code would produce this error:

 Type  
   TMyStream = Class(TStream,Integer)  
 

Hint: Mixing signed expressions and longwords gives a 64bit result

If you divide (or calculate the modulus of) a signed expression by a longword (or vice versa), or if you have overflow and/or range checking turned on and use an arithmetic expression (+, -, *, div, mod) in which both signed numbers and longwords appear, then everything has to be evaluated in 64-bit arithmetic which is slower than normal 32-bit arithmetic. You can avoid this by typecasting one operand so it matches the result type of the other one.
Warning: Mixing signed expressions and cardinals here may cause a range check error

If you use a binary operator (and, or, xor) and one of the operands is a longword while the other one is a signed expression, then, if range checking is turned on, you may get a range check error because in such a case both operands are converted to longword before the operation is carried out. You can avoid this by typecasting one operand so it matches the result type of the other one.
Error: Typecast has different size (arg1 -¿ arg2) in assignment

Type casting to a type with a different size is not allowed when the variable is used in an assignment.
Error: enums with assignments cannot be used as array index

When you declared an enumeration type which has C-like assignments, such as in the following:

   Tenum = (a,b,e:=5);  
 

you cannot use it as the index of an array.

Error: Class or Object types ”arg1” and ”arg2” are not related

There is a typecast from one class or object to another while the class/object are not related. This will probably lead to errors.
Warning: Class types ”arg1” and ”arg2” are not related

There is a typecast from one class to another while the classes are not related. This will probably lead to errors.
Error: Class or interface type expected, but got ”arg1”

The compiler expected a class or interface name, but got another type or identifier.
Error: Type ”arg1” is not completely defined

This error occurs when a type is not complete: i.e. a pointer type which points to an undefined type.
Warning: String literal has more characters than short string length

The size of the constant string, which is assigned to a shortstring, is longer than the maximum size of the shortstring (255 characters).
Warning: Comparison might be always false due to range of constant and expression

There is a comparison between a constant and an expression where the constant is out of the valid range of values of the expression. Because of type promotion, the statement will always evaluate to false. Explicitly typecast the constant or the expression to the correct range to avoid this warning if you think the code is correct.
Warning: Comparison might be always true due to range of constant and expression

There is a comparison between a constant and an expression where the constant is out of the valid range of values of the expression. Because of type promotion, the statement will always evaluate to true. Explicitly typecast the constant or the expression to the correct range to avoid this warning if you think the code is correct.
Warning: Constructing a class ”arg1” with abstract method ”arg2”

An instance of a class is created which contains non-implemented abstract methods. This will probably lead to a runtime error 211 in the code if that routine is ever called. All abstract methods should be overridden.
Hint: The left operand of the IN operator should be byte sized

The left operand of the in operator is not an ordinal or enumeration which fits within 8 bits. This may lead to range check errors. The in operator currently only supports a left operand which fits within a byte. In the case of enumerations, the size of an element of an enumeration can be controlled with the {$PACKENUM} or {$Zn} switches.
Warning: Type size mismatch, possible loss of data / range check error

There is an assignment to a smaller type than the source type. This means that this may cause a range-check error, or may lead to possible loss of data.
Hint: Type size mismatch, possible loss of data / range check error

There is an assignment to a smaller type than the source type. This means that this may cause a range-check error, or may lead to possible loss of data.
Error: The address of an abstract method cannot be taken

An abstract method has no body, so the address of an abstract method cannot be taken.
Error: Assignments to formal parameters and open arrays are not possible

You are trying to assign a value to a formal (untyped var, const or out) parameter, or to an open array.
Error: Constant Expression expected

The compiler expects an constant expression, but gets a variable expression.
Error: Operation ”arg1” not supported for types ”arg2” and ”arg3”

The operation is not allowed for the supplied types.
Error: Illegal type conversion: ”arg1” to ”arg2”

When doing a type-cast, you must take care that the sizes of the variable and the destination type are the same.
Hint: Conversion between ordinals and pointers is not portable

If you typecast a pointer to a longint (or vice-versa), this code will not compile on a machine using 64 bits addressing.
Warning: Conversion between ordinals and pointers is not portable

If you typecast a pointer to an ordinal type of a different size (or vice-versa), this can cause problems. This is a warning to help in finding the 32-bit specific code where cardinal/longint is used to typecast pointers to ordinals. A solution is to use the ptrint/ptruint types instead.
Error: Can’t determine which overloaded function to call

You’re calling overloaded functions with a parameter that doesn’t correspond to any of the declared function parameter lists. e.g. when you have declared a function with parameters word and longint, and then you call it with a parameter which is of type integer.
Error: Illegal counter variable

The type of a for loop variable must be an ordinal type. Loop variables cannot be reals or strings.
Warning: Converting constant real value to double for C variable argument, add explicit typecast to prevent this.

In C, constant real values are double by default. For this reason, if you pass a constant real value to a variable argument part of a C function, FPC by default converts this constant to double as well. If you want to prevent this from happening, add an explicit typecast around the constant.
Error: Class or COM interface type expected, but got ”arg1”

Some operators, such as the AS operator, are only applicable to classes or COM interfaces.
Error: Constant packed arrays are not yet supported

You cannot declare a (bit)packed array as a typed constant.
Error: Incompatible type for arg no. arg1: Got ”arg2” expected ”(Bit)Packed Array”

The compiler expects a (bit)packed array as the specified parameter.
Error: Incompatible type for arg no. arg1: Got ”arg2” expected ”(not packed) Array”

The compiler expects a regular (i.e., not packed) array as the specified parameter.
Error: Elements of packed arrays cannot be of a type which need to be initialised

Support for packed arrays of types that need initialization (such as ansistrings, or records which contain ansistrings) is not yet implemented.
Error: Constant packed records and objects are not yet supported

You cannot declare a (bit)packed array as a typed constant at this time.
Warning: Arithmetic ”arg1” on untyped pointer is unportable to {$T+}, suggest typecast

Addition/subtraction from an untyped pointer may work differently in {$T+}. Use a typecast to a typed pointer.
Error: Can’t take address of a subroutine marked as local

The address of a subroutine marked as local cannot be taken.
Error: Can’t export subroutine marked as local from a unit

A subroutine marked as local cannot be exported from a unit.
Error: Type is not automatable: ”arg1”

Only byte, integer, longint, smallint, currency, single, double, ansistring, widestring, tdatetime, variant, olevariant, wordbool and all interfaces are automatable.
Hint: Converting the operands to ”arg1” before doing the add could prevent overflow errors.

Adding two types can cause overflow errors. Since you are converting the result to a larger type, you could prevent such errors by converting the operands to this type before doing the addition.
Hint: Converting the operands to ”arg1” before doing the subtract could prevent overflow errors.

Subtracting two types can cause overflow errors. Since you are converting the result to a larger type, you could prevent such errors by converting the operands to this type before doing the subtraction.
Hint: Converting the operands to ”arg1” before doing the multiply could prevent overflow errors.

Multiplying two types can cause overflow errors. Since you are converting the result to a larger type, you could prevent such errors by converting the operands to this type before doing the multiplication.
Warning: Converting pointers to signed integers may result in wrong comparison results and range errors, use an unsigned type instead.

The virtual address space on 32-bit machines runs from $00000000 to $ffffffff. Many operating systems allow you to allocate memory above $80000000. For example both Windowsand linuxallow pointers in the range $0000000 to $bfffffff. If you convert pointers to signed types, this can cause overflow and range check errors, but also $80000000 ¡ $7fffffff. This can cause random errors in code like ”if p¿q”.
Error: Interface type arg1 has no valid GUID

When applying the as-operator to an interface or class, the desired interface (i.e. the right operand of the as-operator) must have a valid GUID.
Error: Invalid selector name ”arg1”

An Objective-C selector cannot be empty, must be a valid identifier or a single colon, and if it contains at least one colon it must also end in one.
Error: Expected Objective-C method, but got arg1

A selector can only be created for Objective-C methods, not for any other kind of procedure/function/method.
Error: Expected Objective-C method or constant method name

A selector can only be created for Objective-C methods, either by specifying the name using a string constant, or by using an Objective-C method identifier that is visible in the current scope.
Error: No type info available for this type

Type information is not generated for some types, such as enumerations with gaps in their value range (this includes enumerations whose lower bound is different from zero).
Error: Ordinal or string expression expected

The expression must be an ordinal or string type.
Error: String expression expected

The expression must be a string type.
Warning: Converting 0 to NIL

Use NIL rather than 0 when initialising a pointer.
Error: Objective-C protocol type expected, but got ”arg1”

The compiler expected a protocol type name, but found something else.
Error: The type ”arg1” is not supported for interaction with the Objective-C and the blocks runtime.

Objective-C and Blocks make extensive use of run time type information (RTTI). This format is defined by the maintainers of the run time and can therefore not be adapted to all possible Object Pascal types. In particular, types that depend on reference counting by the compiler (such as ansistrings and certain kinds of interfaces) cannot be used as fields of Objective-C classes, cannot be directly passed to Objective-C methods or Blocks, and cannot be encoded using objc_encode.
Error: Class or objcclass type expected, but got ”arg1”

It is only possible to create class reference types of class and objcclass
Error: Objcclass type expected

The compiler expected an objcclass type
Warning: Coerced univ parameter type in procedural variable may cause crash or memory corruption: arg1 to arg2

univ parameters are implicitly compatible with all types of the same size, also in procedural variable definitions. That means that the following code is legal, because single and longint have the same size:

 {$mode macpas}  
 Type  
   TIntProc = procedure (l: univ longint);  
 
   procedure test(s: single);  
     begin  
       writeln(s);  
     end;  
 
   var  
     p: TIntProc;  
   begin  
     p:=test;  
     p(4);  
   end.  
 

This code may however crash on platforms that pass integers in registers and floating point values on the stack, because then the stack will be unbalanced. Note that this warning will not flag all potentially dangerous situations. when test returns.

Error: Type parameters of specializations of generics cannot reference the currently specialized type

Recursive specializations of generics like Type MyType = specialize MyGeneric<MyType>; are not possible.
Error: Type parameters are not allowed on non-generic class/record/object procedure or function

Type parameters are only allowed for methods of generic classes, records or objects
Error: Generic declaration of ”arg1” differs from previous declaration

Generic declaration does not match the previous declaration
Error: Helper type expected

The compiler expected a class helper type.
Error: Record type expected

The compiler expected a record type.
Error: Derived class helper must extend a subclass of ”arg1” or the class itself

If a class helper inherits from another class helper the extended class must extend either the same class as the parent class helper or a subclass of it
Error: Derived record or type helper must extend ”arg1”

If a record helper inherits from another record helper it must extend the same record that the parent record helper extended.
Error: Invalid assignment, procedures return no value

This error occurs when one tries to assign the result of a procedure or destructor call. A procedure or destructor returns no value so this is not possible.
Warning: Implicit string type conversion from ”arg1” to ”arg2”

An implicit type conversion from an ansi string type to an unicode string type is encountered. To avoid this warning perform an explicit type conversion.
Warning: Implicit string type conversion with potential data loss from ”arg1” to ”arg2”

An implicit type conversion from an unicode string type to an ansi string type is encountered. This conversion can lose data since not all unicode characters may be represented in the codepage of destination string type.
Warning: Explicit string typecast from ”arg1” to ”arg2”

An explicit typecast from an ansi string type to an unicode string type is encountered. This warning is off by default. You can turn it on to see all suspicious string conversions.
Warning: Explicit string typecast with potential data loss from ”arg1” to ”arg2”

An explicit typecast from an unicode string type to an ansi string type is encountered. This conversion can lose data since not all unicode characters may be represented in the codepage of destination string type. This warning is off by default. You can turn it on to see all the places with lossy string conversions.
Warning: Unicode constant cast with potential data loss

Conversion from a WideChar to AnsiChar can lose data since now all unicode characters may be represented in the current system codepage You can nest function definitions only 31 levels deep.
Error: range check error while evaluating constants (arg1 must be between arg2 and arg3)

Warning: range check error while evaluating constants (arg1 must be between arg2 and arg3)

The constants are outside their allowed range.
Error: This type is not supported for the Default() intrinsic

Some types like for example Text and File Of X are not supported by the Default intrinsic.
Error: JVM virtual class methods cannot be static

Virtual class methods cannot be static when targeting the JVM platform, because the self pointer is required for correct dispatching.
Error: Final (class) fields can only be assigned in their class’ (class) constructor

It is only possible to assign a value to a final (class) field inside a (class) constructor of its owning class.
Error: It is not possible to typecast untyped parameters on managed platforms, simply assign a value to them instead.

On managed platforms, untyped parameters are translated by the compiler into the equivalent of var x: BaseClassType. Non-class-based types passed to such parameters are automatically wrapped (or boxed) in a class, and after the call the potentially modified value is assigned back to the original variable. On the caller side, changing untyped var/out parameters happens by simply assigning values to them (either class-based or primitive ones). On the caller side, they will be extracted and if their type does not match the original variable’s, an exception will be raised.
Error: The assignment side of an expression cannot be typecasted to a supertype on managed platforms

Managed platforms guarantee type safety at the bytecode level. This means that the virtual machine must be able to statically determine that no type-unsafe assignments or operations occur. By assigning a parent class type to a variable of a child type by typecasting the assignment side to the parent class type, the type safety would no longer be guaranteed and the generated code would fail verification at run time time.
Warning: The interface method ”arg1” raises the visibility of ”arg2” to public when accessed via an interface instance

Error: The interface method ”arg1” has a higher visibility (public) than ”arg2”

All methods in an interface have always public visibility. That means that if an interface method is implemented using a (strict) protected or private method, this method is actually publicly accessible via the interface. On the JVM target this situation results in an error because the JVM rejects such attempts to circumvent the visibility rules. On other targets this is a warning that is disabled by default because such situations are common practice, but it can be enabled in case you are concerned with keeping your code compilable for the JVM target.
Error: TYPEOF can only be used on object types with VMT

Typeof() intrinsic returns pointer to VMT of its argument. It cannot be used on object types that do not have VMT.
Error: It is not possible to define a default value for a parameter of type ”arg1”

Parameters declared as structured types, such as files, variants, non-dynamic arrays and TP-style objects, cannot have a default value.
Error: Type ”arg1” cannot be extended by a type helper

Types like procedural variables cannot be extended by type helpers
Error: Procedure or function must be far in order to allow taking its address: ”arg1”

In certain i8086 memory models (medium, large and huge), procedures and functions have to be declared ’far’ in order to allow their address to be taken.
Warning: Creating an instance of abstract class ”arg1”

The specified class is declared as abstract and thus no instance of this class should be created. This is merely a warning for Delphi compatibility.
Error: Subroutine references cannot be declared as ”of object” or ”is nested”, they can always refer to any kind of subroutine

Subroutine references can refer to any kind of subroutine and hence do not require specialisation for methods or nested subroutines.
Error: Procedure variables in that memory model do not store segment information

Warning: The first value of a set constructur range is greater then the second value, so the range describes an empty set.

If a set is constructed like this: s:=[9..7];], then an empty set is generated. As this is something normally not desired, the compiler warns about it.
Error: C block reference must use CDECL or MWPASCAL calling convention.

When declaring a C block reference ensure that it uses either the cdecl or mwpascal calling convention either by adding the corresponding function directive or by using the {$Calling} compiler directive.
Boolean operator.(A ! B) will give 61, which is 0011 1101~Binary Ones Complement Operator is unary and has the effect of 'flipping' bits. (~A ) will give -61, which is 1100 0011 in 2's complement form due to a signed binary number.<<Binary Left Shift Operator. The left operands value is moved left by the number of bits specified by the right operand. A << 2 will give 240, which is 1111 0000>>Binary Right Shift Operator. The left operands value is moved right by the number of bits specified by the right operand. A >> 2 will give 15, which is 0000 1111

Please note that different implementations of Pascal differ in bitwise operators. Free Pascal, the compiler we used here, however, supports the following bitwise operators −

OperatorsOperations
notBitwise NOT
andBitwise AND
orBitwise OR
xorBitwise exclusive OR
shlBitwise shift left
shrBitwise shift right
<<Bitwise shift left
>>Bitwise shift right

Operators Precedence in Pascal

Operator precedence determines the grouping of terms in an expression. This affects how an expression is evaluated. Certain operators have higher precedence than others; for example, the multiplication operator has higher precedence than the addition operator.

For example x = 7 + 3 * 2; here, x is assigned 13, not 20 because operator * has higher precedence than +, so it first gets multiplied with 3*2 and then adds into 7.

Here, operators with the highest precedence appear at the top of the table, those with the lowest appear at the bottom. Within an expression, higher precedence operators will be evaluated first.

Show Examples

OperatorPrecedence
~, not,Highest
*, /, div, mod, and, &

0 Comments

Leave a Comment

Proudly Powered By WordPress.

Theme Kaira by .