[fpc-pascal] Variant record consistency
Tomas Hajny
XHajT03 at hajny.biz
Sun Aug 7 22:51:54 CEST 2016
On Sun, August 7, 2016 18:11, Mark Morgan Lloyd wrote:
Hello Mark,
> Given a declaration
>
> const
> topDataQword= 29;
> topNameChar= 231;
>
> type
> Tfnord= record
> case boolean of
> false: (data: array[0..topDataQword] of qword);
> true: (name: array[0..topNameChar] of char;
> inode: qword) (* For recovery if name is
> changed *)
> end;
>
> is it possible to enforce a rule that the two record variants must be
> the same size?
What would the rule supposedly do? As far as I know, all the variants take
the size of the largest one technically (in memory). Do you mean that the
compiler should warn if their declared size differs?
Tomas
More information about the fpc-pascal
mailing list