The scalar class, Procedure and function type errors – HP SunSoft Pascal 4.0 User Manual

Page 235

Advertising
background image

Error Diagnostics

211

9

Thus, if you try to assign an

integer

value to a

char

variable, you receive a

diagnostic as follows:

In this case, one error produces a two-line error message. If the same error
occurs more than once, the same explanatory diagnostic is given each time.

The

scalar

Class

The only class whose meaning is not self-explanatory is

scalar

. It has a

precise meaning in the Pascal standard where it refers to

char

,

integer

, and

boolean

types as well as the enumerated types. For the purposes of the

Pascal compiler,

scalar

in an error message refers to a user-defined

enumerated type, such as

color

in:

type color = (red, green, blue)

For integers, the more precise denotation

integer

is used.

Procedure and Function Type Errors

For built-in procedures and functions, two kinds of errors may occur. If a
routine is called with the wrong number of arguments, a message similar to the
following is displayed:

If the type of an argument is wrong, you receive a message similar to the
following:

Mon Feb 13 13:16:20 1995 inchar.p:

E 25190 line 6 - Type clash: integer is incompatible with char

... 25560: Type of expression clashed with type of variable in assignment

Mon Feb 13 13:21:26 1995 sin.p:

E 10010 line 6 - Builtin function SIN takes exactly 1 argument

Mon Feb 13 13:31:14 1995 abs.p:

E 10180 line 8 - Argument to ABS must be of type integer or real, not char

Advertising