Skip to content

Latest commit

 

History

History
92 lines (57 loc) · 1.73 KB

File metadata and controls

92 lines (57 loc) · 1.73 KB

 

 

 

 

 

 

typedef is a keyword to define shorthand names for data types.

 


typedef std::vector<int>::const_iterator Iterator;

 

Avoid typedefs at file scope in header files [1]. When using function pointers, consider always using a typedef [2].

 

 

 

 

 

 

  • Use UpperCamelCase for typedef names [3]
  • Prefer using over typedef for defining aliases [4]

 

 

 

 

 

 

  1. John Lakos. Large-Scale C++ Software Design. 1996. ISBN: 0-201-63362-0. Chapter 2.3.3
  2. Joint Strike Fighter Air Vehicle C++ Coding Standards for the System Development and Demonstration Program. Document Number 2RDU00001 Rev C. December 2005. AV Rule 176: 'A typedef will be used to simplify program syntax when declaring function pointers.'
  3. Trevor Misfeldt, Gregory Bumgardner, Andrew Gray. The elements of C++ style. 2004. ISBN: 978-0-521-89308-4. Chapter 4.2, page 18: 'Use UpperCamelCase for classes, constants, structures, enumerations, and typedefs'
  4. C++ Core Guidelines item T.43: 'Prefer using over typedef for defining aliases'