Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is this code declaring a type?

Tags:

c

#ifdef _CPU_8BIT_INT_
// unsigned 8 bit
typedef unsigned _CPU_8BIT_INT_ u8 ;

What is the code above doing? Is it trying to declare a type? (type as in integer, char etc.)

like image 644
exxcellent Avatar asked Dec 02 '25 16:12

exxcellent


1 Answers

Yes, typedef is used to declare a type. From now on

u8 x;
/* Equivalent to. */
unsigned _CPU_8BIT_INT_ x;

Are you sure you're not better off using uint8_t from stdint.h ?

like image 131
cnicutar Avatar answered Dec 05 '25 08:12

cnicutar



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!