[fpc-devel] Record types with unbounded trailing data

Jonas Maebe jonas at freepascal.org
Tue Jun 25 19:39:36 CEST 2019


On 25/06/2019 19:19, Ben Grasset wrote:
> On Mon, Jun 24, 2019 at 12:41 AM Michael Van Canneyt
> <michael at freepascal.org <mailto:michael at freepascal.org>> wrote:
> 
>     If you want to get rid of warnings, define it as
>     LOGPALETTE = record
>         palVersion : WORD;
>         palNumEntries : WORD;
>         palPalEntry : array[0..(MAXINT div sizeof(PALETTEENTRY)] of
>     PALETTEENTRY;
>     end;
> 
> 
> Wouldn't that explicitly make the LOGPALETTE type unavoidably gigantic,
> though?

Yes, but whether it's an array declared with 1 element or with (MAXINT
div sizeof(PALETTEENTRY) element, you will never declare an actual
variable that has this type. You will always use pointers to this type.


Jonas


More information about the fpc-devel mailing list