Am 30.03.2012 17:40 schrieb "Mark Morgan Lloyd" <
markmll.fpc-pas...@telemetry.co.uk>:
>
> 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?

No, there is no possibility. But why dies it try to do a type conversion in
the first place? Can you show your code please?

Also operator overloads should be considered "from great power comes great
responsibility".

Regards,
Sven
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to