Search code examples
ctypesintegertypedef

uint vs. unsigned int - Why not typedef uint?


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

typedef unsigned int uint;

Solution

  • The negative effect is stylistic, namely that making your own home-brewed types turns your code unreadable. Nobody knows what "uint" is, so using such a home-made type is far worse practice than using unsigned int.

    Instead of this, you should use the standardized integer types from stdint.h.