lkml.org 
[lkml]   [2021]   [May]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [RFC v2] bpf.2: Use standard types and attributes
Date
* Alejandro Colomar:

> The thing is, in all of those threads, the only reasons to avoid
> <stdint.h> types in the kernel (at least, the only explicitly
> mentioned ones) are (a bit simplified, but this is the general idea of
> those threads):
>
> * Possibly breaking something in such a big automated change.
> * Namespace collision with userspace (the C standard allows defining
> uint32_t for nefarious purposes as long as you don't include
> <stdint.h>. POSIX prohibits that, though)
> * Uglier

__u64 can't be formatted with %llu on all architectures. That's not
true for uint64_t, where you have to use %lu on some architectures to
avoid compiler warnings (and technically undefined behavior). There are
preprocessor macros to get the expected format specifiers, but they are
clunky. I don't know if the problem applies to uint32_t. It does
happen with size_t and ptrdiff_t on 32-bit targets (both vary between
int and long).

Thanks,
Florian

\
 
 \ /
  Last update: 2021-05-04 21:46    [W:2.734 / U:0.700 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site