|
From: | Joel Cunningham |
Subject: | Re: [lwip-devel] What is xchar() macro? |
Date: | Wed, 01 Nov 2017 10:26:06 -0500 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 |
On 11/01/2017 10:07 AM, Ambroz Bizjak wrote:
Also, C99 documents isprint() etc as functions not macros, so "#ifndef isprint" seems broken in that respect.
In the GCC ARM Embedded toolchain, they are defined as macros for plain C (does a check for #ifndef __cplusplus), otherwise there are function declarations.
On Wed, Nov 1, 2017 at 4:05 PM, Ambroz Bizjak <address@hidden> wrote:My guess is that xchar is completely nonstandard and the code works only because <ctype.h> is not included leading to the custom definitions within "#ifndef isprint" to be used. Might be interesting to see what happens if one adds #include <ctype.h> at the top of ip6_addr.c
ctype.h was already implicitly included through existing headers in my port, that's how come the #ifndef isprint block was not compiled in and thus I didn't get xchar. I agree with you that other ports which have successfully compiled the ip6_addr.c must not have had ctype.h included or isprint and friends were not macros.
I think a simple fix would be moving the xchar macro out of that block and we could guard with #ifndef xchar for whatever bizarre platform provides it
On Wed, Nov 1, 2017 at 1:05 PM, goldsimon <address@hidden> wrote:Ambroz Bizjak wrote:Clearly xchar(i) returns the uppercase hexadecimal char for the given integer in range [0,15], or in other words "0123456789ABCDEF"[i].Of course. I rather read Joel's question like "where is this function standardized to keep the lwip code portable when using it". Simon _______________________________________________ lwip-devel mailing list address@hidden https://lists.nongnu.org/mailman/listinfo/lwip-devel_______________________________________________ lwip-devel mailing list address@hidden https://lists.nongnu.org/mailman/listinfo/lwip-devel
Joel
[Prev in Thread] | Current Thread | [Next in Thread] |