I ask this because it doesn’t strike me as being the precise declaration thing you claim to insist upon there. It allows…sloppy (putting this diplomatically…)…code to exist. It glosses over poor definitions of a class hierarchy and it masks all sorts of other things because you don’t get feedback from things with it.
As a developer, you should strive to be precise as you possibly can in declaration and implementation. Having a catch-all class type defeats this and it’s bad from the standards perspective. It also makes it opaque in ways you didn’t want in code…especially in an example code item in a library.
It should instill mistrust in your code doing any of that. Whether it’s in the standard and YOU signed off on it or in any example or actual, you know, production code. If you have difficulty expressing the variable’s type in even a transient expression that leaves scope almost immediately, you’ve done something WRONG and should re-think it, not magically make a variable to catch the object, etc. This wrong includes the actual standard. C++ was supposed to be a simplification of C use and an amplifier for it…not the 21st century’s equivalent of PL1.
Why the rant? Well…I encountered this, what I consider rubbish, with examples and use of a wrapper for libgpiod intended for C++. Fail. Seriously. If the Compiler can’t figure out simple declarations or you can’t have simple ones, you’ve made it overcomplicated. Resorting to auto variables is a crutch for that bad. It’s not something I’d ship out as a FOSS project (And I have a lot of those available on GitHub and elsewhere.)- simple as you can possibly make it is KING as it lowers the risk of errors and things breaking down in bitrot fashion over time. If you use this in examples, you FAIL as it’s not explanatory…you cheated and did what amounts to a Kludge in the worst way. Doesn’t matter if it’s, “in the standard,” it doesn’t make the use clear other than to take that same lame cheat yourself. Please stop people.
Recent Comments
No comments to show.Categories