Peter Gerwinski wrote:
Leonardo A. Saravia wrote:
I have just installed gpc-19990118.i386-pc-djgppv201.zip and try to compile a program designed for VMS (VAX) or CMS (IBM) operative systems. I will appreciate some help, it seems to be a configuration problem, and I am new with Pascal and GNU Pascal.
autocor.pas: In function `Add': autocor.pas:311: warning: constructing limited integer set `0..255'
These warnings are coming from sets like "[ i ]" where `i' is a variable of plain integer type. GPC cannot currently handle "set of Integer" and warns about the restriction of the valid scope for `i'.
Maybe we should take out this warning - it is somewhat too verbose ...
I don't think so, since it can be a real problem, if I understand it correctly. If i is < 0 or > 255, the result will be wrong, right?
However, if i is declared as 0 .. 255 rather than Integer, this is safe (modulo GPC's missing range checking :-/), and there is no warning.
However^2, GPC will soon know `Include' and `Exclude' (compatible to BP 7) which will be able to handle out of range values correclty (i.e., cause a runtime error or ignore them, but not cause a wrong result).
And perhaps, some day, GPC will be able to handle sets of dynamic size, and `[i]' with i : Integer will work without problems...
Frank
Frank Heckenbach wrote:
Maybe we should take out this warning - it is somewhat too verbose ...
I don't think so, since it can be a real problem, if I understand it correctly. If i is < 0 or > 255, the result will be wrong, right?
Right.
Other compilers that cannot handle sets with limits outside 0..255 have the same problem but do not warn. So there is a lot of existing code with this problem.
Peter