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

Noel Duffy noelduffy at xtra.co.nz
Tue May 12 23:11:13 CEST 2020


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?

> 
> (and I hate underscores, but that's beside the point ;))

Uh-oh! (looking at sea of underscores in my Pascal code!) ;)




More information about the fpc-pascal mailing list