[fpc-devel] Feature request/discussion - SetLengthNoInit

Ozz Nixon ozznixon at gmail.com
Thu Sep 17 07:13:10 CEST 2020


Then, I would suggest it gets bolted into strutils, or sysutils. There are
many good reasons to optimize Setlength(), especially for script authors :-)

Currently, I am working (learning) Alpha Controls (alphaskins), and trying
to find a fit into FCL/LCL, or Graeme's GUI. And if I tweak too much,
things forget to draw - so I understand avoiding "core" bloat. But, Isn't
that what SYSUTILs is for :-)

Ozz

On Wed, Sep 16, 2020 at 11:33 PM J. Gareth Moreton via fpc-devel <
fpc-devel at lists.freepascal.org> wrote:

> Ah yes, that works, thanks.
>
> I feel a bit silly because I haven't explored these useful features as
> much as I should, possibly because assembly language isn't object oriented!
>
> I think the difficulty with getting things like this approved is that it
> crosses into the realm of defining the language itself.  I can't say I
> speak on behalf of Florian or Jonas, but I sense they want to avoid
> feature bloat that became a bit of an issue with Delphi.
>
> Gareth aka. Kit
>
> On 17/09/2020 04:03, Ryan Joseph via fpc-devel wrote:
> >
> >> On Sep 17, 2020, at 9:59 AM, J. Gareth Moreton via fpc-devel <
> fpc-devel at lists.freepascal.org> wrote:
> >>
> >> type generic TMyArray<T> = record
> >>    Data: ^T;
> >>    Length: PtrUInt;
> >> end;
> >>
> >> The compiler will complain about T being an unresolved forward
> declaration.  Outside of specifying a second parameter for the pointer type
> (which would be a little unfriendly for third-party users), there isn't
> really a way around this.
> >>
> > To be clear all the features work but it's not as optimized as dynamic
> arrays and could be cumbersome with arrays of records.
> >
> > I think you're supposed to redeclare a pointer to T:
> >
> > type generic TMyArray<T> = record
> >    type
> >      TP = ^T;
> >    public
> >      Data: TP;
> >      Length: PtrUInt;
> > end;
> >
> >
> > Regards,
> >       Ryan Joseph
> >
> > _______________________________________________
> > fpc-devel maillist  -  fpc-devel at lists.freepascal.org
> > https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
> >
>
> --
> This email has been checked for viruses by Avast antivirus software.
> https://www.avast.com/antivirus
>
> _______________________________________________
> fpc-devel maillist  -  fpc-devel at lists.freepascal.org
> https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20200917/ed73f1f5/attachment.htm>


More information about the fpc-devel mailing list