28.06.2013 Views

ISO Pascal reference manual

ISO Pascal reference manual

ISO Pascal reference manual

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

PROGRAM fail;<br />

VAR p : PACKED ARRAY C1..5] OF char;<br />

u : ARRAY [2..6] OF Boolean;<br />

BEGIN<br />

pack(u, 2, p); [boolean can't be assigned to char}<br />

END.<br />

*ERROR 142-- the type of this expression is not suitable as an<br />

index into the unpacked array<br />

This error indicates an attempt to use a value of an unsuitable type to index<br />

the unpacked array in a PACK or UNPACK statement.<br />

PROGRAM fail;<br />

TYPE t1 = (a, b, c, d);<br />

t2 = 0..3;<br />

VAR p : PACKED ARRAY [t1] OF char;<br />

u : ARRAY [t2] OF char;<br />

BEGIN<br />

pack(u, a, p); (a is not of type t2}<br />

unpack(p, u, a); (ditto}<br />

END.<br />

*ERROR 143 -- this string contains more than 255 characters<br />

The compiler limits the maximum number of characters in a string constant<br />

to 255. It is unlikely that this message will ever be generated as it takes a<br />

fair degree of effort to generate a source file containing such a constant<br />

(which is why no sample program is given here).<br />

*ERROR 144 -- string constants must contain at least two characters<br />

This error is caused by a string or character constant which contains no<br />

characters, i.e. two consecutive quotes. The <strong>Pascal</strong> standard states that one<br />

character between quotes is a constant of type CHAR and that string<br />

constants must have two or more characters in them.<br />

PROGRAM fail(output);<br />

BEGIN<br />

writeln("); {" is a null string}<br />

END.<br />

96 <strong>Pascal</strong> Issue I

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!