[fpc-pascal] Default record const values
Martok
listbox at martoks-place.de
Mon Nov 12 12:59:37 CET 2018
Am 10.11.2018 um 12:17 schrieb Ryan Joseph:
> This also fails.
I personally find this case much more limiting.
Another implication is that you can't build up consts from other record consts,
such as:
------------------------------
type
TMyRecord = record
a: integer;
b: string;
end;
const
TMyRecord_Default: TMyRecord = (a: 100; b: 'foo');
TMyRecord_Another: TMyRecord = (a: 200; b: 'bar');
SomeRecords: array[0..1] of TMyRecord = (
TMyRecord_Default,
TMyRecord_Another);
------------------------------
There is a pointer hack to get around that, but it would be really useful if
this worked out of the box.
And yes, I know this is because record consts are (writeable, at worst) typed
consts and as such are only preinitialized global variables, not true consts,
but it still bothers me...
--
Regards,
Martok
More information about the fpc-pascal
mailing list