[fpc-pascal] Custom assignment operators
Mark Morgan Lloyd
markMLl.fpc-pascal at telemetry.co.uk
Fri Mar 30 17:40:06 CEST 2012
A few weeks ago somebody (Martin?) suggested I got round an endianness
issue by doing this:
type WordLE= packed record b0, b1: byte; end;
operator := (wle: WordLE): word;
begin
..
It works well, except that attempting to use an assignment inside the
operator definition immediately recurses: I've fixed this by using
Move(), with operand sizes check by assertion.
Is it possible to tell the compiler that, for a code fragment like this,
it is under no circumstances to attempt any implicit type conversions?
--
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