[Oberon] Type conversion.

Joerg joerg.straube at iaeth.ch
Tue Jul 4 23:41:20 CEST 2023


Sergey

It is clear that the connversion of signed16 —> signed32 max have the effect you described. However, in UDP/TCP messages you only transfer 16 bits of the port, so the status of the higher bits should not matter.

If the remPort was signed16, I strongly assume locPort was signed16 as well.
So why in one case explicit, in the other case implicit.
The code does not make sense to me unless remPort and locPort had  different types.

br
Jörg

> Am 04.07.2023 um 18:52 schrieb Sergey Durmanov <serge.durmanov at yandex.ru>:
> 
> 
> Hi,.
> because previously signed types were used for ports, and the remote port number could be greater than max(signed16), causing the sign bit to propagate. this code is now unnecessary.
> 
> 02.07.2023, 22:52, "Joerg" <joerg.straube at iaeth.ch>:
> Hi
> 
> I can‘t answer the question, why the author of this source code uses „remPort“ with an explicit conversion and „locPort“ with the implicit conversion, the compiler generates.
> 
> br
> Jörg
> 
> https://lists.inf.ethz.ch/mailman/listinfo/oberon
> --
> Oberon at lists.inf.ethz.ch mailing list for ETH Oberon and related systems
> https://lists.inf.ethz.ch/mailman/listinfo/oberon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.inf.ethz.ch/pipermail/oberon/attachments/20230704/ab405515/attachment.html>


More information about the Oberon mailing list