[fpc-devel] Aligned dynamic arrays

Ryan Joseph ryan at thealchemistguild.com
Fri Mar 29 17:53:59 CET 2019


First minor snag, fpc_dynarray_insert, fpc_dynarray_concat can allocate new arrays like SetLength can. Do we need to make aligned variants for these also? Using array + operators there is no possibility to set alignment.

var
  a, b: array of integer;
begin
  a += [1]; // no way to set alignment for a

  insert(1, b, 0); // no way to set alignment for b
end.

Some options:

1) ignore the problem
2) make extra syntax like: 

	a: array of integer; alignment = 64;

3) make another function to allocate an empty array that sets alignment

	SetAlignment(a, 64);
4) for insert/concat make variants like InsertAligned() and ignore + operators for aligned arrays

Regards,
	Ryan Joseph




More information about the fpc-devel mailing list