http://www.45mercystreet.com/computing/typedefs.html
I've read this guy's arguments and I'm still not convinced. Typedefs are incredibly useful. Say I'm implementing a tree to store ints but later I want to reuse it to store char*s if I don't use typedef I'm going to need to change every single instance that the int is used. If I had used a typedef I could have defined each node of the tree to contain a key_t and just change the type of key_t in one line. How is this code obfuscation?
So are typedefs harmful or not in your EXPERT opinion?
I only ever use typedefs in order to remove the struct keyword or for types that are completely abstracted behind an API, so I guess I'm not concerned.
Name:
Anonymous2011-08-21 15:08
Typdefs are mostly used to make structs opaque to the user of an API. This helps to decouple the implementation from the interface what is always an good idea (outside of Data Driven Programming).
That guy doesn't know shit about programing.
<frameset>
Nor about HTML.
Name:
Anonymous2011-08-21 16:14
>>1
You're going to have to dramatically improve your critical sense if you want to survive on the Internet...
Name:
Anonymous2011-08-21 17:13
Typedefs are useful if they are properly used.
This is the tl;dr of it all. Don't use typedefs if what you're going to do with the extra type is more than passing them around.
Name:
Anonymous2011-08-21 17:31
Introducing pointless typedefs like PDWORD and mystruct_t absolutely is code obfuscation.
Using typedefs where you would use templates in C++ is stupid because a typedef can only mean one thing. What if I want a tree of char *and a tree of int? Using #define is better, because you can prefix the function names and use both trees at the same time. But the best is to use the include/linux/list.h technique and don't use a tree containing foos, but foos that contain trees.
Documentation/CodingStyle chapter 5 has some more advice.
Are you really this god damn stupid? Or are you just trolling?
Name:
Anonymous2011-08-21 21:05
>>13
I'm not the retard that made the following statement:
Polymorphic functions come from functional programming (e.g. Haskell) which is like parameter overloading.
Cripes, I don't think even your second your computer science student at a school like CSU Hawyard would make such an idiotic statement. Presumably, unlike you, they know and appreciate the difference between the two.
You've once again demonstrated that you don't have the mental capacity to do computer programmer. Now go help another customer you mental midget. Or if tonight is your night off, do something that is a tad bit easier. Like watching TV.
>>13
BTW, I don't hire dumbasses like you for *any* kind of actual programming work at my firm. Maybe, just maybe, if I was in a good mood, and felt sorry for you, I'd give you a job that involved answering customers technical problems over the phone.
Though he might have a good point about how typedefs are used in C. For example, size_t. You always have to remember that size_t is an int (or long) because it's being compared against ints all the time.
Name:
Anonymous2011-08-21 23:32
>>14-15
i fucking hate you; I want Xarn back and this guy dead, right this instant!
Name:
Anonymous2011-08-22 0:51
Overloading considered hardmful
Pointer casting considered harmful
Changing consts considered harmful
Water considered harmful
Living considered harmful to health