Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: rump and htonl() in constants



In article <CAK4o1Wwm2tXKpdO_Dhdmw-Wxii_nLf+dYPZc6TurtDmZ+-53nw%mail.gmail.com@localhost>,
Justin Cormack  <justin%specialbusservice.com@localhost> wrote:
>On 28 February 2015 at 11:17, Patrick Welche <prlw1%cam.ac.uk@localhost> wrote:
>> The surprise is that when building rump, gcc complains with:
>>
>>
>> /usr/src/sys/rump/net/lib/libnet/../../../../net/route.c:1010:21:
>error: initializer element is not constant
>>  static const struct in_addr inmask32 = {.s_addr = INADDR_BROADCAST};
>>                      ^
>> /usr/src/sys/rump/net/lib/libnet/../../../../net/route.c:1010:21:
>error: (near initialization for 'inmask32.s_addr')
>>
>>
>> which certainly looks constant. Problem is that INADDR_BROADCAST may
>> contain a call to htonl(), e.g. try
>
>> Given that 0xffffffff is the same in either order, there is an obvious
>> kludge, but any thoughts on an elegant solution?
>
>Hmm, I hadnt seen that. Maybe define an HTONL macro that uses shifts
>and masks ifdef little endian so it is all done at compile time?

Are you trying to compile without optimization?

christos



Home | Main Index | Thread Index | Old Index