Wireshark-dev: Re: [Wireshark-dev] Compilation error in ws_mempbrk_sse42.c
From: Guy Harris <guy@xxxxxxxxxxxx>
Date: Tue, 4 Nov 2014 14:55:51 -0800
On Nov 4, 2014, at 2:32 PM, Stephen Fisher <stephenfisher@xxxxxxxxxxxxxxx> wrote:

> On Tue, Nov 04, 2014 at 12:34:36PM -0800, Guy Harris wrote:
> 
>> int8_t is a C99 datatype; older versions of various UN*Xes might not 
>> support it, and, even on those that do, you might have to include 
>> <stdint.h>.  Given that older versions might not support it, and might 
>> not have <stdint.h>, it's probably best not to use it.
> 
> FreeBSD 10 doesn't have int8_t in /usr/includes/stdint.h.

From a quick look at the current FreeBSD source (from SVN), /usr/include/sys/stdint.h includes a bunch of other header files, including <sys/_stdint.h>, which typedefs int8_t and the other C99 types.  It typedefs them in terms of types defined in $ARCHITECTURE/include/_types.h.  Multi-platform OSes, especially those running on both 32-bit and 64-bit platforms, tend to have a twisty little maze of header files, all different, for things such as that.

> I know we used to avoid using C99 things like that, but do we compile in such a 
> way to make the compiler not work with C99 code?

Yes, we compile without including <stdint.h>, except on Windows.  On some platforms, the stdint.h types are either defined in a different header, or we happen to include a header that happens to transitive-closure-of-include <stdint.h>.  On FreeBSD, apparently not so.