On Wed, 22 Sep 2004, Chris Ross wrote:
env_unix.c:1633: warning: cast to pointer from integer of different size
env_unix.c:1636: warning: cast from pointer to integer of different size
  ..type of warnings.  The ones listed there I doubt are terribly important,
but some of them may very well indicate problems.

You can disregard these warnings entirely.

A few pedantic C compilers get upset at the use of void* as a bucket to hold an arbitrary cell, even though this is often the only way to do something *and* the programmer indicated his intent with an explict cast (which supposedly tells the compiler "I know what I'm doing, damnit!").

Particularly, tho, I've found a problem that doesn't produce an error.
In tcp_unix.c, getsockname() is called, and the third argument given
to is is a size_t*.  However, on NetBSD, it calls for a socklen_t*, which
is a pointer to a 32-bit value, and size_t is a long, and therefore 64 bits.

Sigh. On some systems, it's an int* (and socklen_t is undefined). On some, it's a socklen_t*. And on some, it's a size_t* (and socklen_t is undefined). At UW, we have examples of all three; and there's no good way for the code to know what it is on the system being built. That's why c-client casts it to a void*.


And on some systems, an int is 16 bits, and if getsockname() expects a pointer to a 32-bit cell it won't do the right thing either.

There's simply no way to win on every possible platform.

I suggest that the best thing to do is have the NETBSD osdep files redefine getsockname() as a jacket function into the real one. Take a look at the SCO osdep files for an example (e.g. how rename() gets redefined). Of course, that assumes that all NETBSD is 64 bit or at least follows the socklen_t* convention; if not then a new port has to be spawned off.

-- Mark --

http://staff.washington.edu/mrc
Science does not emerge from voting, party politics, or public debate.
Si vis pacem, para bellum.

Reply via email to