Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
hexc11196yMeh I like using it in my classes so I don't have to retype long types... It's more of a convenience thing than anything and provided that the name is understandable I don't see the problem. Also these days "using" is the new typedef like "using uint_list = std::vector<unsigned int>;".
-
meladath406y@hexc Considering auto exists, I can't possibly understand that as a reason to use typedef.
Its not that I have a problem with uses of typedef that make sense. But when it's like 4 layers deep and the actually type is only written a single fucking time in a header file... RIGHT BELOW THE TYPEDEF.... Not lots of times in different classes etc. as you would expect. It really gets to me trying to fish through the layer of shit. -
hexc11196y@meladath you can't use auto for member variables or function parameters, those are the spots I like having shorter names. Have you ever had a constructor with like 5 params that are all vectors of some type, that shit get so long... But I agree when it's many layers deep, it can get your of hand to figure out the type, especially when templating is involved.
-
devios157016ySome types (like function ptrs etc.) can be very long and ugly. Typedef just lets you abstract that to a simpler identifier so you don’t have to type that ugly thing out each time. I don’t use typedef a lot but I’m certainly glad it exists.
-
meladath406yFunction pointers are one of the few times I find typedef acceptable.
Unless your type is a nested template at least 3 deep I really cannot understand typedeffing it. Is it really that hard to type a couple more chars? I mean, in comparison to the huge amount of butt pain it causes for literally every single other Dev on the project.
Imo it must also be typed out lots. Who gives a shit if you are using a long ass type as a function parameter? It's not like you are manipulating that type often. -
I love typedefs because I hate the useless verbosity of struct, enum, union being thrown in everywhere.
Related Rants
I FUCKING HATE TYPEDEF.
I have NEVER seen a use of typedef that wasn't UTTERLY pointless AND did absolutely nothing except add obfuscation to code.
What the fuck is the point of typedeffing a size_t to "MapIndex".. And THEN typedeffing a vector... Of vectors... Of size_t (not MapIndex!) AND THEN TYPEDEFFING A MAP OF "MapIndex" to that previously typedeffed vector of vectors....
ITS FUCKING BEYOND STUPID. I absolutely hate typedef. I have never seen a single NOT RETARDED usage of it.
Have you?
rant
typedef
c++