String errors, Digits in real numbers – HP SunSoft Pascal 4.0 User Manual

Page 230

Advertising
background image

206

Pascal 4.0 User’s Guide

9

Most nonprinting characters in your input are also illegal, except in character
constants and character strings. Except for the tab and formfeed characters,
which are used to format the program, nonprinting characters in the input file
print as the character

?

in your listing.

String Errors

Encountering an end-of-line after an opening string quotation mark (

'

)

without first encountering the matching closing quote yields the diagnostic:

Unmatched ' for string.

Also, anything enclosed in double quotes (for example,

"hello"

) is treated as

a comment and is, therefore, ignored.

Programs containing

#

characters (other than in column 1 or in arbitrary-based

integers) can produce this diagnostic, because early implementations of Pascal
use

#

as a string delimiter. In this version,

#

is used for

#include

and

preprocessor directives, and must be in column 1.

Digits in Real Numbers

Pascal requires digits in

real

numbers before the decimal point. Thus, the

statements

b := .075;

and

c := 05e-10;

generate the following

diagnostics in Pascal:

These constructs are also illegal as data input to variables in

read

statements

whose arguments are variables of type

real

,

single

,

shortreal

,

double

,

and

longreal

.

Mon Feb 13 10:46:44 1995 digerr.p:

5

b:= .075;

e 18740-------------------^--- Digits required before decimal

point

6

c:= .05e-10

e 18740-------------------^--- Digits required before decimal

point

Advertising