Browse DevX
Sign up for e-mail newsletters from DevX


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.




Building the Right Environment to Support AI, Machine Learning and Deep Learning

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.



Thanks for your registration, follow us on our social networks to keep up-to-date