Login | Register   
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

Using typedef to Curb Miscreant Code

Typedef declarations help create platform-independent types and can even hide complex or unintelligible syntax. Predictably, however, using typedef comes with its own set of surprises. Learn how to navigate these pitfalls and use typedef to clean up your code.


advertisement
typedef declaration, or a typedef for short, creates a new name for an existing type. As such, it is often used in writing more aesthetic and readable code. Aesthetics not withstanding, typedefs can also hide unwieldy syntactic constructs and platform-dependent datatypes, thereby enhancing portability and future maintenance. The following sections show how to exert the power of typedef while avoiding common traps.


How to create platform-independent datatypes and hide cumbersome, if not unintelligible, syntax?


Use typedefs to create synonyms for existing types.





Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap