sizeof int /= size of void*

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

sizeof int /= size of void*

Stephen Leake-3
In mingw64, pointers are 64 bit, 'int' is 32 bit. So I'm getting an
error in netxx:

../monotone/src/netxx_pipe.cc:365:31: error: cast from 'HANDLE {aka void*}' to 'Netxx::socket_type {aka int}' loses precision [-fpermissive]
   return (Netxx::socket_type) named_pipe;

The context is:

Netxx::socket_type
Netxx::PipeStream::get_socketfd (void) const
{
#ifdef WIN32
  return (Netxx::socket_type) named_pipe;
#else
  return Netxx::socket_type(-1);
#endif
}

'socket_type' is declared in src/netxx/types.h:

    /// type for representing socket file descriptors
    typedef signed int socket_type;

Changing this to:

    /// type for representing socket file descriptors
#ifdef WIN32
    typedef HANDLE socket_type;
#else
    typedef signed int socket_type;
#endif

fixes that error. There are still a couple of others, like:

      if (fd == -1)
        break;


Should I commit these changes in nvm, or use a devel branch?

--
-- Stephe

_______________________________________________
Monotone-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/monotone-devel