This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC][PATCH 1/4][BZ 17083] getaddrinfo: Add comments for #else and #endif directives


Dnia 11 września 2017 22:01:10 CEST, DJ Delorie <dj@redhat.com> napisał(a):
>
>Łukasz Stelmach <stlman@poczta.fm> writes:
>>  #if __BYTE_ORDER == __BIG_ENDIAN
>>  # define htonl_c(n) n
>> -#else
>> +#else  /* __BYTE_ORDER == __BIG_ENDIAN */
>>  # define htonl_c(n) __bswap_constant_32 (n)
>> -#endif
>> +#endif	/* __BYTE_ORDER == __BIG_ENDIAN */
>
>What's our policy on inverting the logic sense in these comments when
>they refer to the #else clause?

If I were to answer that question (which I am not sure, because I was the first to ask a question and I don't like when people answer my questions with theirs) looking at the results of "git grep", I'd say, it is hard to tell. It appears #else-es' comments contain not-ted conditions, but the syntax is not clear.

Which one would you recommend?

/* Not __BYTE_ORDER == __BIG_ENDIAN */

/* !(__BYTE_ORDER == __BIG_ENDIAN) */

/* __BYTE_ORDER != __BIG_ENDIAN */


-- 
Łukasz Stelmach z podróży


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]