Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

uint vs. unsigned int - Why not typedef uint? [closed]

I was wondering if there are any side-effects defining uint.

typedef unsigned int uint;
like image 900
Soft Waffle Avatar asked Dec 18 '22 13:12

Soft Waffle


1 Answers

Reading code like that is pain in the neck.

If you want to save some typing then use unsigned. That's shorthand for an unsigned int and is standard C. Standard C is readable C.

If you are attempting to standardise the sizes and ranges of integral types, then use the ones in <stdint.h> instead.

like image 184
Bathsheba Avatar answered Dec 31 '22 00:12

Bathsheba