c++ - When does it make sense to typedef basic data types? -


a company's internal c++ coding standards document states basic data types int, char, etc. 1 should define own typedefs "typedef int int". justified advantage of portability of code. there general considerations/ advice when (in means types of projects) make sense? in advance..

typedefing int int offers no advantage @ (it provides no semantic benefit, , leads absurdities typedef long int on other platforms remain compatible).

however, typedefing int e.g. int32_t (along long int64_t, etc.) offer advantage, because free choose data-type relevant width in self-documenting way, and portable (just switch typedefs on different platform).

in fact, compilers offer stdint.h contains of these definitions already.


Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -