[fpc-pascal] Return value of StrToHostAddr and StrToHostAddr6 in sockets unit

Noel Duffy noelduffy at xtra.co.nz
Wed May 13 10:35:27 CEST 2020


On 13/05/20 6:41 pm, Marc Weustink via fpc-pascal wrote:
> 
> On 12-5-2020 14:56, Marco van de Voort wrote:
>>
>> Op 2020-05-12 om 12:32 schreef Michael Van Canneyt:

>>> I'm all for it, but please use the following names:
>>>
>>> function TryStrToHostAddr(IP: String; var ip4: in_addr): Boolean;
>>> function TryStrToHostAddr6(IP: String; var ip6: in6_addr): Boolean;
>>>
>>> Rationale for this request: All conversion calls in sysutils and 
>>> dateutils use this naming scheme, it's good for consistency.
>>>
>>> (and I hate underscores, but that's beside the point ;))
>>>
>> Yes to the principle and yes to the TryStrTo naming. But I would make 
>> the IP param CONST ;-)
> 
> And maybe change the var into an out

As I've already learned the hard way, the sockets unit is compiled in 
"fpc" mode, so there's no "out" parameters. Otherwise I would definitely 
have used one.





More information about the fpc-pascal mailing list