> On Mar 29, 2019, at 5:25 PM, Sven Barth via fpc-devel 
> <fpc-devel@lists.freepascal.org> wrote:
> 
> Ignoring something is not an answer. At least there'd need to be a runtime 
> error.
> 
> Thinking about it maybe it would be better to follow Anthony's idea with the 
> record and not try to adjust/extend a language mechanism that wasn't geared 
> for that.

Biggest problems with records is that we can’t make arrays of records because 
the [] property copies the record with the getter (my other email on this never 
got posted). If there was a feasible way to fix that problem then dynamic 
arrays would be nearly obsolete anyways (probably still faster though).

var
 A: TAlignedArray<TPoint>;
begin
 A.Length := 1;
 A[0].x := 100; // Doesn’t work, writes to a copy and never mutates the 
underlying structure.

Is there no other way to specify alignment? It would be ugly but a compiler 
directive could be used.

var
 {$push}
 {$dynamic-array-align 4096}
 a: array of integer;
 {$pop}
begin
  SetLength(a,10); // just use normal SetLength now

Regards,
        Ryan Joseph

_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply via email to