voc icon indicating copy to clipboard operation
voc copied to clipboard

comparing an open array with 0X character

Open norayr opened this issue 9 years ago • 1 comments

imagine a procedure

PROCEDURE a(VAR s : ARRAY OF CHAR);

now let's say we want to test s[i] for something, but mistakenly write

IF s = 0X THEN

should there be warning or error about that?

norayr avatar Feb 04 '16 14:02 norayr

This is probably OK and equivalent to

IF s = "" THEN

The spec says in 3.4 that

A string of length 1 can be used wherever a character constant is allowed and vice versa.

So 0X is allowed wherever a string of length one is allowed, as I believe it is in this case.

dcwbrown avatar Jul 07 '16 14:07 dcwbrown