On Jun 8, 2011, at 2:39 PM, Ben Greear wrote: > On 06/08/2011 11:36 AM, Jim Rees wrote: >> greearb@xxxxxxxxxxxxxxx wrote: >> >> + if (local_ip&& local_ip->is_set) { >> + sa = (struct sockaddr *)(char *)(&local_ip->addr); >> + salen = local_ip->addrlen; >> + } else { >> + switch (family) { >> + case AF_INET: >> + sa = (struct sockaddr *)(char *)&sin; >> + salen = sizeof(sin); >> + break; >> + case AF_INET6: >> + sa = (struct sockaddr *)(char *)&sin6; >> + salen = sizeof(sin6); >> + default: >> + break; >> + } >> >> Are the double casts actually necessary? And if so, shouldn't the inner one >> be (void *)? > > They are not, as far as I know..I was copying some > similar code I found elsewhere in nfs-utils. > > Unless someone knows a reason to keep this, I'll just > remove the inner cast. Using (char *) tells the compiler to ignore pointer aliasing rules. Instead, use "union nfs_sockaddr" where you can. I'm not sure the double cast is needed for the latter two examples above. -- Chuck Lever chuck[dot]lever[at]oracle[dot]com -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html