[fpc-pascal] Return value of StrToHostAddr and StrToHostAddr6 in sockets unit
Michael Van Canneyt
michael at freepascal.org
Wed May 13 09:26:39 CEST 2020
On Wed, 13 May 2020, Noel Duffy via fpc-pascal wrote:
> On 12/05/20 10:32 pm, Michael Van Canneyt wrote:> On Tue, 12 May 2020,
> Noel Duffy via fpc-pascal wrote:>>>> A simple solution is to add
> functions to the sockets unit which accep
>>> a var record into which the output will be written and which return a
>>> boolean to indicate success or failure. E.g,
>>>
>>> function inet_pton4(IP: String; var ip4: in_addr): Boolean;
>>> function inet_pton6(IP: String; var ip6: in6_addr): Boolean;
>>>
>>
>> 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.
>
> Sure, I can do that. I will look at creating a patch for this. For your
> purposes, do you prefer to have a new bug in the bug tracker opened for
> tracking this change?
Always a new issue for new changes. Makes it easier to track where something
went wrong if something is wrong.
I have applied and committed your patch and resolved the current bugreport.
Your test program went into the testsuite.
Many thanks for your efforts !
>
>>
>> (and I hate underscores, but that's beside the point ;))
>
> Uh-oh! (looking at sea of underscores in my Pascal code!) ;)
Enjoy the view ;-)
Michael.
More information about the fpc-pascal
mailing list