Reply to post: Re: Compatibility

OK, this time it's for real: The last available IPv4 address block has gone

Neil Alexander

Re: Compatibility

"I, for example, want to know if two addresses are the same. With IPv4 I look at them, do strcmp or simple 32 bit integer arithmetic; with IPv6 I have do do a massively complex normalisation step first then line them up on paper and use my fingers."

Computationally, strcmp is, and always has been, the wrong way to do this. What if I decide to throw some leading zeroes into an octet, i.e. 010 instead of 10?

The correct answer, as it always has been, is to use inet_pton (or the equivalent in your favourite language) and compare the two addresses in binary form. That's just as true in IPv4 as it is in IPv6.

As for the human element, well in IPv4 you already remove trailing zeroes in your head from each octet and you can continue doing that for each quad in IPv6. As for address expansion, well that's hardly rocket science either.

None of this is actually difficult, you're just not used to it. You will get used to it. It just takes a little bit of time.

POST COMMENT House rules

Not a member of The Register? Create a new account here.

  • Enter your comment

  • Add an icon

Anonymous cowards cannot choose their icon


Biting the hand that feeds IT © 1998–2020