Re: [fpc-pascal] Coercing record fields together

2018-07-09 Thread Ralf Quint
On 7/9/2018 9:22 AM, Ryan Joseph wrote: Could I do some RTL magic on a record to loop over its fields and set them to another record by name? In the example below I want to set all the fields in TRecA to matching named fields in TRecB. Just curious if we can do this automatically using RTL.

Re: [fpc-pascal] Loss of precision when using math.Max()

2018-07-09 Thread gtt
Zitat von Florian Klaempfl : I am happy to implement this in delphi mode, but it requires some documentation references how delphi evaluates such expressions (which precision is used when and why) and how they are handled in expressions. These links may be of interest:

Re: [fpc-pascal] Coercing record fields together

2018-07-09 Thread Ryan Joseph
> On Jul 9, 2018, at 11:57 AM, gabor wrote: > > Hi. > Probably can be done with RTTI (1), enumerators (2) and generics (3) together. > > 1. https://stackoverflow.com/questions/27803383/fpc-rtti-on-records > 2. http://wiki.freepascal.org/for-in_loop#Traversing_container > 3.

Re: [fpc-pascal] Loss of precision when using math.Max()

2018-07-09 Thread Florian Klaempfl
Am 09.07.2018 um 19:55 schrieb g...@wolfgang-ehrhardt.de: Zitat von Martok : To make sure this works, one has to manually make the const expression be of the type required: const   e: Extended = Extended(1.0) / 3.0; I seem to remember that this was once documented somewhere for Delphi.

Re: [fpc-pascal] Coercing record fields together

2018-07-09 Thread gabor
Hi. Probably can be done with RTTI (1), enumerators (2) and generics (3) together. 1. https://stackoverflow.com/questions/27803383/fpc-rtti-on-records 2. http://wiki.freepascal.org/for-in_loop#Traversing_container 3. http://wiki.freepascal.org/Generics Michał. W dniu 2018-07-09 o 18:22, Ryan

Re: [fpc-pascal] Loss of precision when using math.Max()

2018-07-09 Thread gtt
Zitat von Martok : To make sure this works, one has to manually make the const expression be of the type required: const e: Extended = Extended(1.0) / 3.0; I seem to remember that this was once documented somewhere for Delphi. Can't seem to find it though, so maybe it was a 3rd-party book?

Re: [fpc-pascal] Coercing record fields together

2018-07-09 Thread DaWorm
Just because someone is bound to suggest it, might as well be me. type TRecA = record a: string; b: string; end; type TRecB = record A: TRecA; c: integer; d: integer; end; RecB.A :=

[fpc-pascal] How to use Google Protocol Buffer

2018-07-09 Thread Dennis
To connect to a server, I need to use Google's Protocol Buffer format. The only workable parser to convert the protocol definition file to pascal reader/writer source code is: the ProtoBufCodeGen in https://github.com/fundamentalslib/fundamentals5/releases Still, there is no documentation on

[fpc-pascal] Coercing record fields together

2018-07-09 Thread Ryan Joseph
Could I do some RTL magic on a record to loop over its fields and set them to another record by name? In the example below I want to set all the fields in TRecA to matching named fields in TRecB. Just curious if we can do this automatically using RTL. type TRecA = record

Re: [fpc-pascal] Loss of precision when using math.Max()

2018-07-09 Thread Martok
Am 03.07.2018 um 23:10 schrieb Florian Klämpfl: >> OK, then two questions remain: Why does is occur/apply only for (newer?) >> 3.1.1 versions? > I dug a little bit deeper, the reason is: > https://bugs.freepascal.org/view.php?id=25121I tried figuring this out, > sharing what I found here for