<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-15">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p>Thought I'd ask. Nothing lost. Just seeking a consensus on how
to address the problem.</p>
<p>Gareth<br>
</p>
<div class="moz-cite-prefix">On 24/06/2019 05:41, Michael Van
Canneyt wrote:<br>
</div>
<blockquote type="cite"
cite="mid:alpine.DEB.2.21.1906240629120.10525@home">
<br>
<br>
On Mon, 24 Jun 2019, J. Gareth Moreton wrote:
<br>
<br>
<blockquote type="cite">Hi everyone,
<br>
<br>
So after a problem over at
<a class="moz-txt-link-freetext" href="https://bugs.freepascal.org/view.php?id=35753">https://bugs.freepascal.org/view.php?id=35753</a> that led to a
change of <a class="moz-txt-link-freetext" href="https://bugs.freepascal.org/view.php?id=35671">https://bugs.freepascal.org/view.php?id=35671</a> , it
became apparent that there may need to be better support for
unbounded arrays in record types - not open arrays, but
unbounded ones.
<br>
<br>
</blockquote>
<br>
[snip]
<br>
<br>
<blockquote type="cite">
<br>
It's a lot to think about for sure, and is probably
overengineering a solution to a very niche problem (I personally
can't think of where one would use such constructs instead of
something with a fixed-size array or just having the header and
open array stored separarely), but is it worth discussing?
<br>
</blockquote>
<br>
No. This *really* is overengineering.
<br>
<br>
If you declare what is clearly a dummy structure, then tricks will
be needed. Disabling range checks on such constructs and warnings
is the only sensible thing to do.
<br>
<br>
If you want to get rid of warnings, define it as
<br>
LOGPALETTE = record
<br>
palVersion : WORD;
<br>
palNumEntries : WORD;
<br>
palPalEntry : array[0..(MAXINT div sizeof(PALETTEENTRY)] of
PALETTEENTRY;
<br>
end;
<br>
<br>
Since you will always work through a getmem'ed memory block &
pointer anyway, and
<br>
all bets are off in that case. There is simply no point in letting
the
<br>
compiler check anything extra since the construct is by definition
uncheckable.
<br>
<br>
Michael.<br>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
fpc-devel maillist - <a class="moz-txt-link-abbreviated" href="mailto:fpc-devel@lists.freepascal.org">fpc-devel@lists.freepascal.org</a>
<a class="moz-txt-link-freetext" href="https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel">https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel</a>
</pre>
</blockquote>
<div id="DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2"><br />
<table style="border-top: 1px solid #D3D4DE;">
<tr>
<td style="width: 55px; padding-top: 13px;"><a href="https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient" target="_blank"><img src="https://ipmcdn.avast.com/images/icons/icon-envelope-tick-round-orange-animated-no-repeat-v1.gif" alt="" width="46" height="29" style="width: 46px; height: 29px;" /></a></td>
<td style="width: 470px; padding-top: 12px; color: #41424e; font-size: 13px; font-family: Arial, Helvetica, sans-serif; line-height: 18px;">Virus-free. <a href="https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient" target="_blank" style="color: #4453ea;">www.avast.com</a>
</td>
</tr>
</table><a href="#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2" width="1" height="1"> </a></div></body>
</html>