On Fri Oct 20 11:09:54 EDT 2006, [EMAIL PROTECTED] wrote: > > but i think it's silly to differentiate between 192.168.0.1 and > > ::ffff:192.168.0.1 an ip6 address. that's like a c compiler declaring > > 0x3 != 3. > > No, it's not. It's like if atoi, in addition to returning > the actual value, also returned the base the number > was written in. Most callers wouldn't care, but some > might.
but it's instructive that atoi does not. i think point of libip is to hide this stuff. do you have an example of code where it would be beneficial to distinguish ::ffff:192.168.0.1 from 192.168.0.1? > Most people calling parseip shouldn't care what > format the address was in, and should use *to > as the address. The only interesting question > that should ever be asked of the return value is whether > or not it is equal to 6. In particular, code that uses > > ip = parseip(to, from); > > and then goes on to use ip as an IP address > is wrong and needs to be rewritten, not catered to. however, if you decide that you don't have an ip4 address based on the fact that parseip returns 6, you are also wrong. i think it would be more useful to know if it is an ip4 address rather than what format it was entered in. just my opinion. - erik
