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
-
scor38042yIt's a rant about readability.
Someone writing in C++ chastising themselves by putting up funny variable / function names then nesting these weirdly.
@-red has created art by abstraction and depiction of one of societies contemporary tormentments. -
@iiii It actually definitely would be more readable, at least for me when in some situations, actual names are used instead of auto or the function names make it clear directly or indirectly what types are being used. Especially when this code is part of a larger clump of Spaghetti.
-
iiii92192y@-red dunno. It should not even matter what type exactly it is, only that it behaves correctly 🤔
-
iiii92192y@-red still should not matter what exact type it is. The readability comes from either the initial value or the name of the function used to get the initial value. Writing exact type matters for declarations, not when you have a local variable for some intermediate results the types of which are known without explicitly assigning that intermediate variable a specific type, which does not matter in the end.
PS: good luck stating exact types in every case if you're using standard template types. -
@iiii I made it quite clear that my complaint is when we're not talking about templates/loop iterators/lambdas.
Imagine you have a lot of complex structs which are meant to be transactions. It helps significantly to know what type of message you're dealing with to get a functional sense for what you're working with or to figure out what members it has and what methods it has so you can work with them later.
Or when you're using different types inferred by auto in operations which might result in incorrect behavior when someone new to the code changes these operations in the slightest way. Simplest of them being dealing with signed and unsigned int.
When someone sees, a < b, how many of them do you think go back and check the types of a and b before modifying this code ? Only a handful. And unfortunately for us, they are outnumbered by the rest.
Related Rants
-
xjose97x19Just saw a variable in C named like this: long time_ago; //in a galaxy far away I laughed no stop.
-
Unskipp24So this happened last night... Gf: my favorite bra is not fitting me anymore Me: get a new one ? Gf: but it ...
-
sam966911Hats off to this lady .... I would have just flipped the machine
auto abuse = veryReabab1eShet();
auto moreAbuse = n0tRealyNo();
auto ohNo = abuse(moreAbuse);
rant
nolambdas
c++
notemplates
noloops
autoabuse