<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">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><br></div><div>thanks,</div><div>Dmitry</div></div></div>