[fpc-pascal] FPC Advanced Records

Mark Morgan Lloyd markMLl.fpc-pascal at telemetry.co.uk
Fri Mar 9 23:26:02 CET 2012

Martin wrote:
> On 09/03/2012 21:26, Mark Morgan Lloyd wrote:
>> but is there any way to define something like an endianness-correcting 
>> type, i.e.:
>> Type TAWSHeader=Record
>>        ThisSize: WordLE;
>> ..
>> where by the time ThisSize is accessed any disparity has been corrected?
> Not sure if this will be of any use.
> but you can always define an assignment incompatible type
>    WordLE = record data: Word; end;
> and define all required overloaded operators

I think that could be of a lot of use, but I'll need to tinker :-)

Noted your example, but apart from that is there any concise way to 
define a type such as WordLE with the explicit restriction that it 
requires an explicit definition of assignment operators (i.e. is never 
subject to implicit casts or type conversions)? Can this be done such 
that WordLE has a predefined size even if the assignment has to go via code?

Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]

More information about the fpc-pascal mailing list