[fpc-devel] BOOL
Florian Klämpfl
florian at freepascal.org
Sun Dec 14 21:22:11 CET 2014
Am 14.12.2014 um 21:22 schrieb Michael Van Canneyt:
>
>
> On Sun, 14 Dec 2014, Florian Klämpfl wrote:
>
>> Am 14.12.2014 um 20:25 schrieb Michael Van Canneyt:
>>>
>>>
>>> On Sun, 14 Dec 2014, Florian Klämpfl wrote:
>>>
>>>> Am 14.12.2014 um 18:05 schrieb Adriaan van Os:
>>>>>> IMHO using the for loop on a non pascal boolean type is simply wrong. At the
>>>>>> very least the assumption that the false and true are successive, and maybe
>>>>>> even using BOOL as loopvar in the first place.
>>>>>
>>>>> The compiler accepts it.
>>>>
>>>> Can somebody with access to delphi please check, if it compiles
>>>>
>>>> var
>>>> b : bytebool;
>>>>
>>>> begin
>>>> for b:=false to true do
>>>> ;
>>>> end.
>>>
>>> D7 and Delphi XE5 compile it but do not generate code, instead say:
>>> 'FOR or WHILE loop executes zero times - deleted
>>> variable b is declared but never used in ...
>>
>> But it generates code for
>>
>> var
>> b : bytebool;
>> begin
>> for b:=true to false do
>> ;
>> end.
>
> Yes, it does. Strange behaviour :)
Well, true is -1 and false 0 :) I wonder if we should forbid it in fpc mode ...
More information about the fpc-devel
mailing list