Reason for using signed char to represent network address?

struct hostent (under both windows and nodes) that are used, for example, with gethostbyname () et al. stores point addresses using a pointer to a signed char .

What is the use of this when he knows in advance that the addresses can and generally contain numbers> 127, and that they are ultimately represented without an sign? Is there any benefit from the possibility of recognition, any kind of edge case? Or is it just historical baggage?

+4
source share
1 answer

This is probably just historical baggage - just like its features.

Currently, it is recommended to use getaddrinfo() and getnameinfo() for protocol independence. gethostbyname() is deprecated, like its gethostbyaddr() counterpart.

+5
source

Source: https://habr.com/ru/post/1402082/


All Articles