lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] typo in src/core/pbuf.c:770


From: Mike Tesch
Subject: Re: [lwip-users] typo in src/core/pbuf.c:770
Date: Mon, 31 Mar 2003 12:14:36 -0600
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2) Gecko/20021202



Bob Ammerman wrote:

How 'bout:
Change: ...printf("blah blah %p blah blah", myptr) To: ...printf("blah blah " LWIP_POINTER_FORMAT " blah blah", LWIP_POINTER_CAST myptr) With: #define LWIP_POINTER_FORMAT "%p"
#define LWIP_POINTER_CAST
or #define LWIP_POINTER_FORMAT "%lx"
#define LWIP_POINTER_CAST (unsigned long)
Bob Ammerman
RAm Systems


Hello,

I'm running into this same problem, except with the definitions of
?32_t and printing them. For example: because s32_t can be either (signed long)
or (signed int) the printf format could be either "%ld" or "%d".
There are also currently inconsistencies in whether "%lu" or "%u" is used to
print u32_t data (neither is the default across all of lwip.)

ISO C99 provides a way to deal with this by using the standard, well defined, types from <stdint.h> int8_t, uint8_t, etc... and from <inttypes.h> - PRId8, PRIu8, etc... In the long term, this seems like the correct way to write portable code, but
maybe everyone doesn't have C99 compatible compilers / libraries yet?
In the short term, it would be "correct" to have lwip local defines of PRId8
and friends (in cc.h,) and to use those, and would make it easier to migrate to
the C99 standard later.  What does everyone think?


Regards,
mt






reply via email to

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