Boost Users :
Subject: Re: [Boost-users] [ASIO] Resolver question
From: Gavin Lambert (gavinl_at_[hidden])
Date: 2016-02-25 17:07:19
On 26/02/2016 05:38, Leon Mlakar wrote:
> On 25.02.2016 16:40, james wrote:
>> Leading zeros in an IP octet indicate octal.
>> If you ping 192.168.077.1 from both Linux and Windows you get
>> > ping 192.168.077.1
>> PING 192.168.077.1 (192.168.63.1) 56(84) bytes of data.
>> Note how it converted 077 to 63.
> The problem seems to be is that apart from the name, there is nothing
> that would guide the interpretation of the leading zeroes in
> dot-*decimal* notation for IPv4 addresses. For instance, while ping on
> my Mac agrees with the octal interpretation, nslookup doesn't::
It's most likely just one of those things that nobody thought someone
would ever do, so the behaviour comes down to the quirks of whatever
text-to-number library function the program happened to use (eg. atoi,
strtol, boost::lexical_cast, etc). Some of those will treat leading
zeroes as octal and some won't.
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net