[fpc-devel] Omit hint/warning for a fixed-size array

Thorsten Engler thorsten.engler at gmx.net
Fri Aug 31 15:13:19 CEST 2018


Perhaps:

var
  Buffer: array[0..255] of Byte = Default;

could be supported as shortcut for:

type
   TByteBuffer = array[0..255] of Byte;
var
   Buffer : TByteBuffer;
begin
   Buffer := Default(TByteBuffer);



> -----Original Message-----
> From: fpc-devel <fpc-devel-bounces at lists.freepascal.org> On Behalf
> Of wkitty42 at windstream.net
> Sent: Friday, 31 August 2018 23:05
> To: fpc-devel at lists.freepascal.org
> Subject: Re: [fpc-devel] Omit hint/warning for a fixed-size array
> 
> On 08/31/2018 08:50 AM, Michael Van Canneyt wrote:
> > On Fri, 31 Aug 2018, wkitty42 at windstream.net wrote:
> >> On 08/30/2018 03:46 AM, Ondrej Pokorny wrote:
> >>> Hello,
> >>>
> >>> is there a way not to get a "Variable xyz does not seem to be
> initialized"
> >>> hint/warning for a fixed-size array?
> >>>
> >>> program Project1;
> >>> uses Classes;
> >>> var
> >>>    Buffer: array[0..255] of Byte;
> >>
> >> what about
> >>
> >>     Buffer: array[0..255] of Byte = [0];
> >
> > No, you would need to suppply the full amount of elements.
> 
> 
> my statement "or similar" should cover that but yeah, i did think
> about that aspect... it is a solution... just not a ""short hand"
> one ;)
> 
> 
> --
>   NOTE: No off-list assistance is given without prior approval.
>         *Please keep mailing list traffic on the list unless*
>         *a signed and pre-paid contract is in effect with us.*
> _______________________________________________
> fpc-devel maillist  -  fpc-devel at lists.freepascal.org
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel




More information about the fpc-devel mailing list