Both ways are legal in the context of the C and C++ standards. That's precisely the reason why using your own typedefs (unless they point to standard fixed width types like uint32_t) is a really bad idea. The compiler of the OP detected that problem (long and int are distinct types, just as they should be!) and made the code more portable in the process.