Typedef - Usage Concerns

Usage Concerns

Some people are opposed to the extensive use of typedefs. Most arguments center on the idea that typedefs simply hide the actual data type of a variable. For example, Greg Kroah-Hartman, a Linux kernel hacker and documenter, discourages their use for anything except function prototype declarations. He argues that this practice not only unnecessarily obfuscates code, it can also cause programmers to accidentally misuse large structures thinking them to be simple types.

Others argue that the use of typedefs can make code easier to maintain. K&R states that there are two reasons for using a typedef. First, it provides a means to make a program more portable. Instead of having to change a type everywhere it appears throughout the program's source files, only a single typedef statement needs to be changed. Second, a typedef can make a complex declaration easier to understand.

Read more about this topic:  Typedef

Famous quotes containing the words usage and/or concerns:

    Girls who put out are tramps. Girls who don’t are ladies. This is, however, a rather archaic usage of the word. Should one of you boys happen upon a girl who doesn’t put out, do not jump to the conclusion that you have found a lady. What you have probably found is a lesbian.
    Fran Lebowitz (b. 1951)

    History in the making is a very uncertain thing. It might be better to wait till the South American republic has got through with its twenty-fifth revolution before reading much about it. When it is over, some one whose business it is, will be sure to give you in a digested form all that it concerns you to know, and save you trouble, confusion, and time. If you will follow this plan, you will be surprised to find how new and fresh your interest in what you read will become.
    Anna C. Brackett (1836–1911)