Hi *,
I found small incompatibility between Delphi and FPC.
This code:
var a,b: array of byte;
begin
setlength(a,2);
b:=copy(a,2,1); //--HERE Range check error in FPC, Delphi
returns empty array
end;
Delphi documentation says:
If Index is larger than the length of S, *Copy* returns an
On Wed, Feb 29, 2012 at 14:44, LacaK la...@zoznam.sk wrote:
Hi *,
I found small incompatibility between Delphi and FPC.
This code:
var a,b: array of byte;
begin
适适 setlength(a,2);
适适 b:=copy(a,2,1); //--HERE Range check error in FPC, Delphi returns
empty array
end;
Delphi documentation
Am 29.02.2012 13:54, schrieb ik:
On Wed, Feb 29, 2012 at 14:44, LacaKla...@zoznam.sk wrote:
Hi *,
I found small incompatibility between Delphi and FPC.
This code:
var a,b: array of byte;
begin
适适 setlength(a,2);
适适 b:=copy(a,2,1); //--HERE Range check error in FPC, Delphi returns
empty array
On Wednesday 29 of February 2012 13:54:40 ik wrote:
On Wed, Feb 29, 2012 at 14:44, LacaK la...@zoznam.sk wrote:
Hi *,
I found small incompatibility between Delphi and FPC.
This code:
var a,b: array of byte;
begin
适适 setlength(a,2);
适适 b:=copy(a,2,1); //--HERE Range check error in
Delphi documentation says:
If Index is larger than the length of S, Copy returns an
empty string
or array. http://docwiki.embarcadero.com/VCL/en/System.Copy
Can it be fixed also in FPC?
I think it's a Delphi bug to act like that. You must provide
a length that is not bigger in
29.02.2012 17:05, Sven Barth пишет:
It's not a bug in Delphi if they write it in the documentation. Whether we
should copy this behavior
is the question (maybe only in Delphi mode).
It cannot be fixed for Delphi mode only because a single copy of RTL is used
for all compiler modes.
The
In the mean time there is tons of code that relies on copy() copying until
end of string or dynamic array. Constructions like
param=copy(s,pos('=')+1,length(s)) are plenty. Just do a grep in the fpc
compiler dir for copy( and you'l find plenty of copy(s,p+1,255) and the
like.
Second that, In
Am 29.02.2012 14:31, schrieb Sergei Gorelkin:
29.02.2012 17:05, Sven Barth пишет:
It's not a bug in Delphi if they write it in the documentation.
Whether we should copy this behavior
is the question (maybe only in Delphi mode).
It cannot be fixed for Delphi mode only because a single copy of
Sergei Gorelkin wrote / napísal(a):
29.02.2012 17:05, Sven Barth пишет:
It's not a bug in Delphi if they write it in the documentation.
Whether we should copy this behavior
is the question (maybe only in Delphi mode).
It cannot be fixed for Delphi mode only because a single copy of RTL
is
29.02.2012 18:21, LacaK пишет:
It cannot be fixed for Delphi mode only because a single copy of RTL is used
for all compiler modes.
The current situation where out of range 'length' parameter is adjusted but
'index' out of range
raises exception is simply self-inconsistent. It is also
ik schrieb:
I think it's a Delphi bug to act like that. You must provide a length
that is not bigger in size. It's up to you the developer.
Otherwise you might have more then one type of buffer overflows in your code !
The way Delphi solved it, is by taking the responsibility from the
Am 29.02.2012 14:31, schrieb Sergei Gorelkin:
The current situation where out of range 'length' parameter is adjusted
but 'index' out of range raises exception is simply self-inconsistent.
It is also inconsistent with behavior of Copy for strings.
Adjusting index will neither cause any buffer
Sergei Gorelkin wrote / napísal(a):
29.02.2012 18:21, LacaK пишет:
It cannot be fixed for Delphi mode only because a single copy of RTL
is used for all compiler modes.
The current situation where out of range 'length' parameter is
adjusted but 'index' out of range
raises exception is simply
13 matches
Mail list logo