Гость
Целевая тема:
Создать новую тему:
Автор:
Форумы / Delphi [игнор отключен] [закрыт для гостей] / XE7 опечатка / 4 сообщений из 4, страница 1 из 1
22.07.2018, 18:24
    #39677382
527470
Гость
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
XE7 опечатка
Решил воспользоваться процедурой TArray.Copy<T> из System.Generics.Collections и обнаружил что в XE7 она работает не верно.
Код: pascal
1.
2.
3.
4.
5.
6.
7.
8.
class procedure TArray.Copy<T>(const Source, Destination: array of T; SourceIndex, DestIndex, Count: NativeInt);
begin
  CheckArrays(Pointer(@Source[0]), Pointer(@Destination[0]), SourceIndex, Length(Source), DestIndex, Length(Destination), Count);
  if IsManagedType(T) then
    System.CopyArray(Pointer(@Destination[SourceIndex]), Pointer(@Source[SourceIndex]), TypeInfo(T), Count)
  else
    System.Move(Pointer(@Destination[SourceIndex])^, Pointer(@Source[SourceIndex])^, Count * SizeOf(T));
end;


Нужно так:
Код: pascal
1.
2.
3.
4.
5.
6.
7.
8.
class procedure TArray.Copy<T>(const Source, Destination: array of T; SourceIndex, DestIndex, Count: NativeInt);
begin
  CheckArrays(Pointer(@Source[0]), Pointer(@Destination[0]), SourceIndex, Length(Source), DestIndex, Length(Destination), Count);
  if IsManagedType(T) then
    System.CopyArray(Pointer(@Destination[DestIndex]), Pointer(@Source[SourceIndex]), TypeInfo(T), Count)
  else
    System.Move(Pointer(@Source[SourceIndex])^, Pointer(@Destination[DestIndex])^, Count * SizeOf(T));
end;


Собственно у меня вопрос в более новых версиях это исправлено?
...
Рейтинг: 0 / 0
22.07.2018, 18:55
    #39677389
Aleksandr Sharahov
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
XE7 опечатка
527470,

в CE исправлено
...
Рейтинг: 0 / 0
23.07.2018, 15:12
    #39677751
_Vasilisk_
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
XE7 опечатка
Tokyo 10.2.3
Код: pascal
1.
2.
3.
4.
5.
6.
7.
8.
class procedure TArray.Copy<T>(const Source: array of T; var Destination: array of T; SourceIndex, DestIndex, Count: NativeInt);
begin
  CheckArrays(Pointer(@Source[0]), Pointer(@Destination[0]), SourceIndex, Length(Source), DestIndex, Length(Destination), Count);
  if IsManagedType(T) then
    System.CopyArray(Pointer(@Destination[DestIndex]), Pointer(@Source[SourceIndex]), TypeInfo(T), Count)
  else
    System.Move(Pointer(@Source[SourceIndex])^, Pointer(@Destination[DestIndex])^, Count * SizeOf(T));
end;
...
Рейтинг: 0 / 0
23.07.2018, 21:41
    #39677960
Vizit0r
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
XE7 опечатка
Seattle

Код: pascal
1.
2.
3.
4.
5.
6.
7.
8.
class procedure TArray.Copy<T>(const Source: array of T; var Destination: array of T; SourceIndex, DestIndex, Count: NativeInt);
begin
  CheckArrays(Pointer(@Source[0]), Pointer(@Destination[0]), SourceIndex, Length(Source), DestIndex, Length(Destination), Count);
  if IsManagedType(T) then
    System.CopyArray(Pointer(@Destination[DestIndex]), Pointer(@Source[SourceIndex]), TypeInfo(T), Count)
  else
    System.Move(Pointer(@Source[SourceIndex])^, Pointer(@Destination[DestIndex])^, Count * SizeOf(T));
end;
...
Рейтинг: 0 / 0
Форумы / Delphi [игнор отключен] [закрыт для гостей] / XE7 опечатка / 4 сообщений из 4, страница 1 из 1
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]