tech-pkg archive

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

Re: u_intX_t vs. uintX_t

On Sun, Jul 01, 2012 at 01:22:06PM +1200, Steven Drake wrote:
 > This is to let everyone know about this issue I've just come across, to 
 > do with the u_intX_t and uintX_t type groups (where X is 8, 16, 32, or 64).
 > Different OS's define the two groups (strangely) in different places:
 > + Linux and NetBSD have (since before C99) made available the u_intX_t
 >   group from <sys/types.h>
 > After C99:
 > + NetBSD has made uintX_t group available from both <sys/types.h> and 
 >   <stdint.h>.
 > + Linux has made the uintX_t group available from <stdint.h> (but _not_
 >   <sys/types.h>).
 > + SunOS have made the uintX_t group available from <sys/types.h> 
 >   and <stdint.h>. (well I'm assuming it does.)
 > If you can't see the problem, may developers include <sys/types.h> and use
 > the u_intX_t group, which doesn't means a package won't build on SunOS,
 > simply changing them to uintX_t types means it now build on SunOS but 
 > not on Linux anymore!

If it uses uint*_t, it should include <stdint.h>. C99 says so.

Therefore (as I was hinting in pkgsrc-changes) if you add stdint.h
because of uint*_t, don't hide it in platform-dependent ifdefs. This
will just cause someone else to have to come fix it again at some
future point.

David A. Holland

Home | Main Index | Thread Index | Old Index