Re: [ooc-compiler] Type of 'SHORT (ENTIER (1.0))'?
Brought to you by:
mva
|
From: Stewart G. <sgr...@us...> - 2009-01-10 22:20:25
|
Hi Frank, I think that's probably a bug. The reason the two statements behave differently may be related to the internal type of the constant '1.0', which is probably LONGREAL until it is coerced to some other type. Most likely, there is a problem with the compile-time evaulation of ENTIER. According to the language report ENTIER of any real type should be LONGINT. Cheers, Stewart Frank Hrebabetzky wrote: > In the following small program > > MODULE Test; > VAR n: INTEGER; > x: REAL; > BEGIN > x:= 1.0; > n:= SHORT (ENTIER (x)); > n:= SHORT (ENTIER (1.0)) > END Test. > > I get the compiler error > "Test.Mod:7:4: Expression not compatible with variable type `INTEGER'". > So the second line starting 'n:= ...' is wrong, but not the first one. > Why? |