[Top][All Lists]

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

Re: [lwip-users] U16_F used in LwIP 1.1.1

From: Christiaan Simons
Subject: Re: [lwip-users] U16_F used in LwIP 1.1.1
Date: Mon, 22 May 2006 09:02:53 +0200

Clive Wilson wrote:

> I notice that the LwIP debug macros have now changed slightly to the
> following format, e.g.
> LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE | DBG_STATE, ("dhcp_handle_nak():
> set request timeout %"U16_F" msecs\n", msecs));
> i.e. they use U16_F. Should this be defined in cc.h?


> How should that
> be defined, compared to the old defines in there, e.g. "typedef
> unsigned short u16_t;"?

The typedefs remain, these aren't 'old'. The _F macro's are additions.
The idea is that we have sized types and _matching_ (sn)printf formatters
for each type. This solves the portability problem where a %d formatter
can describe a 32 bit int on one platform, or 16 bit int on another.

E.g. from the c16x port cc.h:

typedef unsigned   char    u8_t;
typedef signed     char    s8_t;
typedef unsigned   short   u16_t;
typedef signed     short   s16_t;
typedef unsigned   long    u32_t;
typedef signed     long    s32_t;

typedef u32_t mem_ptr_t;

/* Define (sn)printf formatters for these lwIP types */
#define U16_F "hu"
#define S16_F "hd"
#define X16_F "hx"
#define U32_F "lu"
#define S32_F "ld"
#define X32_F "lx"


Christiaan Simons

Hardware Designer
Axon Digital Design


reply via email to

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