u_int32_t vs uint32_t
Alan Coopersmith
Alan.Coopersmith at Sun.COM
Mon Aug 23 16:44:35 PDT 2004
So what about just using CARD32 as the rest of the X code does to define
this portably?
-alan-
Torrey Lyons wrote:
> uint32_t might be preferred, but that does not mean it is defined in
> <sys/types.h> on all platforms. On Darwin one needs to use <stdint.h> or
> <inttypes.h> as suggested in the Solaris 10 documentation. In any case,
> <sys/types.h> is definitely not the right cross platform header file and
> causes build breakage.
>
> --Torrey
>
> At 10:04 AM -0700 8/23/04, Stuart Kreitman wrote:
>
>> Here is a reference to the C99 standard that uint32_t is preferred:
>>
>>
>> http://www.oreillynet.com/pub/a/network/2003/10/07/michael_barr.html
>>
>>
>> With that I'm putting back the update to Wraphelp.c
>>
>> skk
>> Matthieu Herrb wrote:
>>
>>> Stuart Kreitman wrote:
>>>
>>>> Matthieu:
>>>> The editor "fgsch" made the change to u_int32_t in OpenBSD sources
>>>> in April 2002 with your review. Jim Gettys picked it up this weekend
>>>> for the X.ORG next release.
>>>>
>>>> We need to explain how the typedefs "u_int32_t" vs "uint32_t"
>>>> conform to various
>>>> standards in ANSI or ISO. I do not have access to the OpenBSD
>>>> files, but include
>>>> the relevent statements from Solaris:
>>>
>>>
>>>
>>> the u_ variants are the traditional types used on BSD systems and
>>> defined by including <sys/types.h>.
>>>
>>> There is some (limited) previous art of using the u_ types in the X
>>> tree, that's why it looked right to me.
>>>
>>> Defining a fixed width type in a portable manner can be tricky.
>>> I'd suggest include the relevant X header and use CARD32 instead of
>>> u_int32_t / uint32_t. (Even though CARD32 is normally reserved for
>>> the on the wire protocol iirc).
>
> _______________________________________________
> release-wranglers mailing list
> release-wranglers at freedesktop.org
> http://freedesktop.org/mailman/listinfo/release-wranglers
--
-Alan Coopersmith- alan.coopersmith at sun.com
Sun Microsystems, Inc. - X Window System Engineering
More information about the release-wranglers
mailing list