in reply to Removing padding from numeric IP addresses

Ummm... "Padding" is not really a good thing to have in general for IP octets. On some operating systems the leading "0" could imply that the operating system interpret the octet to be an octal value. This being the case "010" would really be interpreted as an "8". This can have very bizzarre side effects for digits greater than 7. SunOS used to do it this way, and I would imagine other do as well. It may look "pretty, symetric, and sort nicely", but it is not good practice, IMHO.
  • Comment on Re: Removing padding from numeric IP addresses

Replies are listed 'Best First'.
(tye)Re: Removing padding from numeric IP addresses
by tye (Sage) on Feb 17, 2001 at 04:31 UTC

    Actually, I don't think this is an operating system feature (when I've seen it, some programs in the operating system exhibited the behavior while others didn't). I think it is just C coders using atol() with an argument of 0 instead of with an argument of 10. I personally consider such as a bug in said C code, but I've seen it enough that I encourage everyone to take your warning seriously.

    Update: Well, I would hope that this bug isn't present in the basic inet libraries on any operating system...

            - tye (but my friends call me "Tye")