On 2 Aug 2006 at 21:05, Frank Heckenbach wrote:
...we try to not be incompatible to EP in GPC dialect unless EP's behaviour is ... well ... too strange (talk about string padding ;-).
Given:
program comp (output);
var s : packed array [1..4] of char;
begin s := 'abc'; if s = 'abc' then writeln ('true') else writeln ('false') end.
...this will print "true" for EP and "false" for GP. But isn't the "if" statement always false in GP mode, regardless of the value of "s"? More generally, wouldn't every fixed-string equality comparison fail (or succeed) statically if the strings were of unequal length?
If so, it would be helpful if GPC issued a warning in this case, e.g, "result of comparison is always false" (note that GCC does this in some cases, e.g., comparison of unsigned value >= 0).
-- Dave