[fpc-pascal] Return value of StrToHostAddr and StrToHostAddr6 in sockets unit
Marco van de Voort
core at pascalprogramming.org
Wed May 13 12:46:16 CEST 2020
Op 12/05/2020 om 23:05 schreef Noel Duffy via fpc-pascal:
>
>>> 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 ;-)
>
> Good idea, and normally I would, but the current implementation of
> StrToHostAddr (see below) does Delete on IP as it processes it. As it
> currently stands this function must accept a non-const.
>
Miight have been when posex() was in strutils, however nowadays Pos()
accepts a start index too. Even shortstring only versions.
More information about the fpc-pascal
mailing list