So sánh u8 và uint8_t năm 2024

Hello,

What is the idea behind this two types? When to use one over another. Basically, they are the same thing:

typedef __u8 uint8_t;

In the linux kernel code I've seen both of them used without any clear rule.

thanks. Daniel.

-- To unsubscribe from this list: send an email with "unsubscribe kernelnewbies" to ***@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ

Hello Daniel,

What is the idea behind this two types? When to use one over another. typedef __u8 uint8_t; In the linux kernel code I've seen both of them used without any clear rule.

Basically, they are the same thing. $ grep uint8_t linux/types.h typedef __u8 uint8_t; $ grep __u8 asm-i386/types.h typedef unsigned char __u8;

But you'd better use uint8_t in you kernel programming practice rather than use __u8 directly. Because asm directory varies on different architecture. The program will get better portability by using uint8_t.In an other words, uint8_t provide more abstraction for '1 byte' type.

-- Adam Jiang ------ e-mail:***@gmail.com

-- To unsubscribe from this list: send an email with "unsubscribe kernelnewbies" to ***@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ