title: Why can we cast sockaddr to sockaddr_in
body: <p>I can see why it is useful to cast <code>sockaddr</code> to <code>sockaddr_in</code>, but I don't understand how this is possible.  From what I've read, they're the same size and <code>sockaddr_in</code> is added with <code>sin_zero</code> to make it the same size.  I would like to know how the compiler knows where to get the information from <code>sockaddr_in</code> if it is layed out differently to <code>sockaddr</code>.</p>