Never use stdint.h? Wasn't that the intent of stdint.h ... for kernel 
code? For embedded code?

---John

On 2016-04-15 08:27, Greg KH wrote:
> On Fri, Apr 15, 2016 at 08:04:53AM -0400, Robert P. J. Day wrote:
>> 
>>   is there a single, decent online doc that explains the proper data
>> types (int16_t, int32_t and so on) to use in kernel code?
> 
> First off, never use int16_t and friends, that's not ok :)
> 
> Second, it's simple, use:
>       u8
>       u16
>       u32
>       u64
> and friends in kernel code (s8, s16, and so on for signed values.)
> 
> 'int' is a return type, and for loops and other things that you know
> will fit in that size.
> 
>> including the relationship with types to be used in code to be
>> exported to user space (include/uapi/linux/types.h)?
> 
> For values that cross the user/kernel boundry, add '__' to the front of
> the variable:
>       __u8
>       __u16
>       __u32
> and so on.  NEVER use 'int' or 'long' crossing that boundry, it's not
> going to work properly.
> 
> I think one of the chapters in LDD3 describes all of this, you might
> want to re-read it for the details.
> 
> hope this helps,
> 
> greg k-h
> 
> _______________________________________________
> Kernelnewbies mailing list
> [email protected]
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


_______________________________________________
Kernelnewbies mailing list
[email protected]
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

Reply via email to