11

WTF C++?! I liked you, I defended you, I told people about you. Then you go and do shit like this:

int main(int argc, char* argv[])
to
auto main(int argc, char* argv[])->int

Seriously C++ WTF?!

Comments
  • 1
    When did this occur? Also, that code has no alibi it’s ugly
  • 7
    I will just quite literally refuse to write it like that.
  • 6
    Seems like a clear example of
    "Not broken, fixed anyway.".
  • 4
    This is alternative syntax that is there so one can write normal functions in the same style that one writes lambdas. To specify lambda return type you go: [] () -> int {}. It makes sense to give the option to write normal functions in the same way imo, even though I find it rather ugly.
  • 0
    There are some good reasons for it, but it has some fuxoring going on too:

    https://blog.petrzemek.net/2017/01/...
  • 1
    b-but... It's Actually longer not shorter... Whyy
  • 2
    @Batburger Except that if you keep the syntaxes separate you have an easy visual way to tell the difference which is lost if normal functions can be written as lambdas. Perhaps it's not a big deal, but it seems like a potential source of future confusion/bugs to me.
  • 0
    I'm adding this rant to my favorites for reminding myself this very situation.
    What the actual fuck is this?
  • 2
    Yes!! Now is the time, they're weak. C-- strike!! https://cs.tufts.edu/~nr/c--/...
  • 1
    @Pyjong Heh, I used to play with C-- like 20 years ago when I couldn't afford a C compiler.
  • 1
    @Demolishun xD ... well.. it's still here
  • 0
    @powerfulparadox thats because simplicity of implementation is not the same thing as comprehensibility.

    For an example of this cognitive bias, look at the design of LISP.

    Everythings a list. Conceptually beautiful. In practice, less so.
  • 2
    *Rust sweating nervously*
  • 1
    @Wisecrack Part of the problem is that purity and simplicity are not the same as understandability (especially when human minds are involved). Another part of the problem is syntax choice: bad syntax can make things harder to distinguish when good syntax can clarify exactly the same expression. (Lisp has problems with both of these to varying degrees.)

    That's not to say that everything must be complex to be understandable. Plan 9 simplified the Unix design even further, and is probably the best OS design I've ever seen. But when it comes to programming languages, it seems that the more explicit the components of the language allow people to be the easier it is for programmers to express their programs clearly. The Turing machine has the simplest, purest possible programming language, but it's also one of the most difficult to comprehend a program in.
  • 0
    I guess I should feel guilty for liking it? I dunno much about C++ in order to properly say if I like it or not :v
Add Comment