[Oberon] Type conversion.
Michael Schierl
schierlm at gmx.de
Sun Jul 2 13:59:44 CEST 2023
Hello,
Am 02.07.2023 um 07:14 schrieb peter at easthope.ca:
> ETH Oberon (2019) Language Report
> p. 56,
> 12.1.1. Conversions
> LONG(x) ... DEPRECATED
Page 21:
Where there is no implicit compatibility between types, they can be
converted with an explicit conversion. The type name itself can be used
for a type conversion.
>
> oberon/source/Unix.Oberon.NetSystem.Mod
> PROCEDURE OpenConnection* ( VAR conn: Connection; locPort: UNSIGNED16; remIP: IPAdr; remPort: UNSIGNED16;
> VAR res: SIGNED16 );
> VAR r: SIGNED32;
> BEGIN
> IF remPort = anyport THEN remIP := anyIP END;
> NEW( conn );
> conn.Open( locPort, remIP, LONG(remPort) MOD 10000H, r );
> IF r = TCP.Ok THEN res := done ELSE res := error END
> END OpenConnection;
>
> If LONG is removed, conn.Open won't agree on the type of the 3rd
> parameter. Is there another way to convert a type? The declaration of
> Open also needs a change?
conn.Open( locPort, remIP, UNSIGNED32(remPort) MOD 10000H, r );
Regards,
Michael
More information about the Oberon
mailing list