Re: [fpc-pascal] sizeof TTypeKind?

2020-03-22 Thread Sven Barth via fpc-pascal
Ryan Joseph via fpc-pascal  schrieb am
So., 22. März 2020, 07:28:

>
>
> > On Mar 21, 2020, at 10:15 PM, Sven Barth via fpc-pascal <
> fpc-pascal@lists.freepascal.org> wrote:
> >
> > For the primitve types you need to know the sizes at compile time (e.g.
> SizeOf(Word), SizeOf(LongInt), etc.) and check what type the field has
> using the field list in the record's RTTI. You also have to keep in mind
> that some types are grouped. E.g. tkInteger is for all integer types that
> are smaller than 64-bit. The real type is then available as
> TTypeData.OrdType and you need to handle that size accordingly. For
> structured types like records the size is contained in the RTTI. The
> FldOffset field is important to get the correct offset of a field, because
> padding might be involved depending on the platform (except if your record
> is "packed").
>
> ok, I guess I need to make a lookup table for tkInteger etc...  or just
> take the field type names directly and map them myself.
>

You don't need to do a lookup table for all types. Retrieve the PTypeData
of the PTypeInfo (using GetTypeData) and check the OrdType if it's a
tkInteger. Based on that you map the size.


> Btw, I was thinking that the new custom attributes could be used to add
> RTTI to record fields but it appears to be limited to classes, and other
> class definitions. Is that correct?


For now that is correct as for everything else extended RTTI is required
(though to be more precise attributes can be used for all type
declarations, not only classes).

Regards,
Sven

>
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Killing the mail list

2020-03-22 Thread Bo Berglund via fpc-pascal
On Sun, 15 Mar 2020 08:58:36 -0700 (PDT), geneb
 wrote:

>Use NNTP.  I think the fpc lists are mirrored here at news.gmane.io.

Exactly!

This is what I have done since I began following FPC/Lazarus (using
the GMane mirror of the mail list) and now I have a local searchable
threaded archive of it all dating back to 2003 inside my news reader!

I was worried a short time ago when GMane suddenly stopped working but
it turned out to be because of loss of the gmane.com domain...
It was soon online again under the domain news.gmane.io and after
changing my newsreader settings to that it just seamlessly continued
working.

This is a LOT BETTER than the web based forums where you have no
overview

(I also use the Lazarus forum, but I could not live without the
mirrored mail list.)


-- 
Bo Berglund
Developer in Sweden

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Killing the mail list

2020-03-22 Thread Jonas Maebe
On 22/03/2020 16:19, Bo Berglund via fpc-pascal wrote:
> On Sun, 15 Mar 2020 08:58:36 -0700 (PDT), geneb
>  wrote:
> 
>> Use NNTP.  I think the fpc lists are mirrored here at news.gmane.io.
> 
> Exactly!

Again: please take this discussion to fpc-other.

Thanks,


Jonas
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal