[zeromq-dev] portable uint32_t ?

Andrew Hume andrew at research.att.com
Thu Aug 5 14:50:06 CEST 2010


ha!
in my code, i define these sorts of things in a basic.h
and also write a basic_check.c
which verifies if (using code like if(sizeof(uint32) != 4) barf();).
and this is run as part of installation.

it is only a short step to putting that into a configure like program.

you can also try being clever with MAX_INT (or whatever it is called)
#if MAXINT > 0x7FFFFFFFLL
#define short uint32
#else
#if MAX_INT > 0x7FFF
#define int uint32
#else
#define long uint32
#endif
#endif

but i woudl check as well.

On Aug 5, 2010, at 8:21 AM, Matt Weinstein wrote:

> Folks,
>
> A quick question -- I really want a uint32_t to hold my 0xdeadbeef, is
> there a portable/preferred way to get a 32 bit unsigned value? (( I
> don't like making assumptions about C99 compliance ))
>
> Thanks,
>
> Best,
>
> Matt
>
> PS We never had this "word length" problem on the IBM 1620 :-)
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev

------------------
Andrew Hume  (best -> Telework) +1 732-886-1886
andrew at research.att.com  (Work) +1 973-360-8651
AT&T Labs - Research; member of USENIX and LOPSA



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20100805/c899639e/attachment.htm>


More information about the zeromq-dev mailing list