<div dir="auto"><div><div class="gmail_quote"><div dir="ltr">Dmitry Boyarintsev <<a href="mailto:skalogryz.lists@gmail.com">skalogryz.lists@gmail.com</a>> schrieb am Mo., 13. Aug. 2018, 00:12:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Sun, Aug 12, 2018 at 5:40 PM Bart <<a href="mailto:bartjunk64@gmail.com" target="_blank" rel="noreferrer">bartjunk64@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">const<br>
x = ShortString('abc');<br>
begin<br>
writeln(SizeOf(x));<br>
end.<br>
<br>
Delphi (7) prints 256, fpc prints 3.<br>
<br>
Is that a bug or an implementation detail?<br></blockquote><div> </div><div>Implementation detail.</div><div>And it seems to be wrong on Delphi size, because for reason it assigns a type to a (non-typed) constant.</div><div>It would make sense to return 256, if the constant was declared like this:</div><div>const </div><div> x : ShortString = 'abc';</div><div>and fpc does recognize such typed constant as 256 in size.</div><div><br></div><div>It's odd that such expression compiles w/o any warnings or notes. (i.e. "ignoring typecasting for constant value expressions")</div></div></div></blockquote></div></div><div dir="auto"><br></div><div dir="auto">Support for typecasts in untyped constants is by design and sometimes required, e.g. for unsigned 64-Bit values. </div><div dir="auto"><br></div><div dir="auto">Regards, </div><div dir="auto">Sven </div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
</blockquote></div></div></div>