[zeromq-dev] HP-UX compile.

George Neill georgen at neillnet.com
Mon Nov 17 18:23:23 CET 2008


On Mon, Nov 17, 2008 at 3:00 AM, Martin Sustrik <sustrik at fastmq.com> wrote:
> Hi George,
> We don't have HP-UX here so it would be helpful if you can check following
> changes and let us know whether they help to get rid of the warnings:
>> "/home/gneill/zmq/trunk/zmq/ip.cpp", line 205: warning #4232-D: conversion
>>          from "sockaddr *" to a more strictly aligned type "sockaddr_in *"
>>          may cause misaligned access
>>      *addr_ = *((sockaddr_in *) res->ai_addr);
> Copying the memory explicitly may help here:
> memcpy (addr_, res->ai_addr, sizeof (sockaddr_in));

Yes this resolves the warning, but probably should be sockaddr (not

-     *addr_ = *((sockaddr_in *) res->ai_addr);
+    memcpy(addr_, res->ai_addr, sizeof(struct sockaddr));

I was wondering why the resolve_ip_hostname function didn't take a
sockaddr* and just use the ai_addr member without casting, but I found
the resolve_ip_hostname function does more than just resolve a
hostname! :)

>> "/home/gneill/zmq/trunk/zmq/select_thread.cpp", line 243: warning #2940-D:
>>          missing return statement at end of non-void function
>>          "zmq::select_thread_t::process_command"
>>  }
> I would say the compiler doesn't recognise "assert (false)" as a termination
> statement. Try this:
> default:
>    assert (false);
>    return false;

This also resolves the warning.


More information about the zeromq-dev mailing list