[fpc-pascal] QWord/UInt64 and Range Check Errors
m2
m2 at ellipsa.net
Thu Jun 25 23:34:27 CEST 2009
Jonas Maebe a écrit :
>
> On 25 Jun 2009, at 20:58, Inoussa OUEDRAOGO wrote:
>
>> 2009/6/25 Jonas Maebe <jonas.maebe at elis.ugent.be>:
>>>
>>> It's equally accurate. A hex number does not contain any sign
>>> information,
>>> so both interpretations are valid.
>>
>> so it could be parsed as QWord accurately and assigned to a QWord
>> (typed) variable without warning, as it is an assignment between two
>> QWORD values.
>
> Pascal is a context-insensitive language, which means that the type of
> an expression does not depend on the context in which it is used. The
> types always fully depend on the expression itself. Therefore the parser
> cannot parse it as "int64 or qword", it has to pick one. So a choice has
> to be made between int64 and qword, and this choice has to be the same
> for every usage of such an expression. The choice has been, from the
> very beginning, int64.
>
> Therefore, while the compiler could be changed to parse it as qword
> instead, it is not possible (without violating the spirit of the Pascal
> language
The fact that Borland regarded "$FF..FF" as a 2's complement
representation and not as a base-16 representation of an integer is
not really what I would call "Pascal spirit". As a matter of fact,
"Borland mess" would be more appropriate. :-)
mm
----
http://www.ellipsa.eu/
More information about the fpc-pascal
mailing list