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: Greg Troxel
Subject: Re: [gpsd-dev] build failure, again, due to endian.h issues
Date: Wed, 06 Nov 2013 08:56:13 -0500
User-agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/23.4 (berkeley-unix)

"Eric S. Raymond" <address@hidden> writes:

> 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.

That's really not good enough.  One must be able to argue from the text
of the standard that it will work.

Attachment: pgpwkrHAvRjvs.pgp
Description: PGP signature


reply via email to

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