Re: [fpc-devel] SizeOf( const typcasted as shortstring)

2018-08-13 Thread Dmitry Boyarintsev
On Mon, Aug 13, 2018 at 5:24 AM Sven Barth via fpc-devel < fpc-devel@lists.freepascal.org> wrote: > It's odd that such expression compiles w/o any warnings or notes. (i.e. >> "ignoring typecasting for constant value expressions") >> > > Support for typecasts in untyped constants is by design and

Re: [fpc-devel] SizeOf( const typcasted as shortstring)

2018-08-13 Thread Sven Barth via fpc-devel
Dmitry Boyarintsev schrieb am Mo., 13. Aug. 2018, 00:12: > On Sun, Aug 12, 2018 at 5:40 PM Bart wrote: > >> const >> x = ShortString('abc'); >> begin >> writeln(SizeOf(x)); >> end. >> >> Delphi (7) prints 256, fpc prints 3. >> >> Is that a bug or an implementation detail? >> > >

Re: [fpc-devel] SizeOf( const typcasted as shortstring)

2018-08-12 Thread Martin
On 13/08/2018 02:32, Martin wrote: On 13/08/2018 00:12, Dmitry Boyarintsev wrote: On Sun, Aug 12, 2018 at 5:40 PM Bart > wrote: const   x = ShortString('abc'); begin   writeln(SizeOf(x)); end. Delphi (7) prints 256, fpc prints 3. Is

Re: [fpc-devel] SizeOf( const typcasted as shortstring)

2018-08-12 Thread Martin
On 13/08/2018 00:12, Dmitry Boyarintsev wrote: On Sun, Aug 12, 2018 at 5:40 PM Bart > wrote: const   x = ShortString('abc'); begin   writeln(SizeOf(x)); end. Delphi (7) prints 256, fpc prints 3. Is that a bug or an implementation

Re: [fpc-devel] SizeOf( const typcasted as shortstring)

2018-08-12 Thread Dmitry Boyarintsev
On Sun, Aug 12, 2018 at 5:40 PM Bart wrote: > const > x = ShortString('abc'); > begin > writeln(SizeOf(x)); > end. > > Delphi (7) prints 256, fpc prints 3. > > Is that a bug or an implementation detail? > Implementation detail. And it seems to be wrong on Delphi size, because for reason it

[fpc-devel] SizeOf( const typcasted as shortstring)

2018-08-12 Thread Bart
Hi, This came up in http://forum.lazarus.freepascal.org/index.php/topic,42179.0.html const x = ShortString('abc'); begin writeln(SizeOf(x)); end. Delphi (7) prints 256, fpc prints 3. Is that a bug or an implementation detail? Just curious. Bart