The following innocuous looking code generates a range check error:
{$R+}
function Count: qword;
begin
Result := 0;
end;
var
i: Integer;
begin
for i := 0 to Count-1 do
WriteLn(i);
end.
I can (more or less) see why, but it means that I can't (for example)
compile the Cocoa widget set i
C Western wrote:
The following innocuous looking code generates a range check error:
The code shouldn't generate a range check error, as the target type is signed.
Note that Oberon was designed by Niklaus Wirth specifically to prevent this kind of problems. See
the notes on type inclusion in
On Sat, Jan 27, 2018 at 10:06 AM, Adriaan van Os wrote:
>
>
> The code shouldn't generate a range check error, as the target type is
> signed.
>
Count returns Unsigned Qword.
unsigned $ is beyond 32-bit boundary.
The similar issue, but more explicit.
{$R+}
function Count: qword;
On 27.01.2018 15:10, C Western wrote:
> The following innocuous looking code generates a range check error:
>
> {$R+}
> function Count: qword;
> begin
> Result := 0;
> end;
> var
> i: Integer;
> begin
> for i := 0 to Count-1 do
> WriteLn(i);
> end.
>
> I can (more or less) see why, but
On 27/01/18 15:06, Adriaan van Os wrote:
C Western wrote:
The following innocuous looking code generates a range check error:
The code shouldn't generate a range check error, as the target type is
signed.
Note that shifting the loop variable to Int64 still triggers the range
check error.
On Sat, Jan 27, 2018 at 9:10 AM, C Western wrote:
>
> I can (more or less) see why, but it means that I can't (for example)
> compile the Cocoa widget set in 64 bit with bounds checking on, as then
> qword seems to be used as a count for, for example, NSarray.
>
> how about taking objc approach:
C Western wrote:
> The following innocuous looking code generates a range check error:
>
> {$R+}
> function Count: qword;
> begin
> Result := 0;
> end;
> var
> i: Integer;
> begin
> for i := 0 to Count-1 do
> WriteLn(i);
> end.
>
> I can (more or less) see why
I changed the type used to
Jonas Maebe wrote:
> C Western wrote:
>> The following innocuous looking code generates a range check error:
>>
>> {$R+}
>> function Count: qword;
>> begin
>> Result := 0;
>> end;
>> var
>> i: Integer;
>> begin
>> for i := 0 to Count-1 do
>> WriteLn(i);
>> end.
>>
>> I can (more or less)
On 27/01/18 16:28, Jonas Maebe wrote:
Jonas Maebe wrote:
C Western wrote:
The following innocuous looking code generates a range check error:
{$R+}
function Count: qword;
begin
Result := 0;
end;
var
i: Integer;
begin
for i := 0 to Count-1 do
WriteLn(i);
end.
I can (more or less
On Sat, Jan 27, 2018 at 12:30 PM, C Western wrote:
>
> The actual code that triggered my interest was:
>
> procedure LCLViewExtension.lclSetEnabled(AEnabled: Boolean);
> var
> ns : NSArray;
> i : integer;
> obj : NSObject;
> begin
> ns := subviews;
> for i := 0 to ns.count - 1 do
> be
On Sat, Jan 27, 2018 at 12:51 PM, Dmitry Boyarintsev <
skalogryz.li...@gmail.com> wrote:
>
> imho, bad approach to adjust compiler for not safe code.
> However, getting a compiler warning would be nice.
>
> Some time ago, the compiler has been extended with for-in syntax:
>
> var
> SubView : NSV
11 matches
Mail list logo