gpsd-dev
[Top][All Lists]
Advanced

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

Re: [gpsd-dev] build failure, again, due to endian.h issues


From: Eric S. Raymond
Subject: Re: [gpsd-dev] build failure, again, due to endian.h issues
Date: Wed, 6 Nov 2013 08:53:48 -0500
User-agent: Mutt/1.5.21 (2010-09-15)

Paul Fertser <address@hidden>:
> On Tue, Nov 05, 2013 at 08:48:52PM -0500, Eric S. Raymond wrote:
> > #define IS_BIG_ENDIAN (*(uint16_t *)"\0\xff" < 0x100)
> 
> I'd expect that string literal to be of type (char[3]) and it can be
> implicitly converted to (char *) and so casting it to (uint16_t *)
> would increase alignment requirements (also, if you ever decide to
> compile gpsd with a C++ compiler it'll also remove constness as string
> literals are const in C++) and that usually produces a warning with
> arm-none-eabi or clang. The alignment restrictions seem to be a real
> issue here so this nice trick is likely to be invalid C99.

I'll try it under clang and see.
-- 
                <a href="http://www.catb.org/~esr/";>Eric S. Raymond</a>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]