6 ms·
In python there is the term "pythonic" describing if something is in the spirit of the languages founding fathers. As in: "The most pythonic way to write this d
by std_throwaway 9y ago
In python there is the term "pythonic" describing if something is in the spirit of the languages founding fathers. As in: "The most pythonic way to write this down is ..." or "Map/filter don't feel very pythonic."
What is the equivalent term or expression for being in the spirit of C++?
The article, while a joke (just like C++ originally, look it up), feels very C++y.
- xsmasher 9y ago"Such-and-such is (not) idiomatic C++"
- 0xbear 9y agoI don't think there's broadly "idiomatic" C++. There's "idiomatic Google C++" though.
- saghm 9y agoWhile what's idiomatic is subjective, I think there's plenty that everyone can agree is not idiomatic, so I think GP's quote is still pretty commonly used
- sqeaky 9y agoI think we can all agree that actively re-purposing the postfix-- operator to perform a dereference on a smart is definitely not idiomatic. Idiomatic might be fuzzy, but it definitely does not include active attempts obfuscation, malice or jokes. The code in the article could be any of these depending on context.
- saghm 9y agoYep, no arguments here!
- int_19h 9y agoNot in a literal sense of the word, perhaps. But in practice, "idiomatic C++" is taken to mean STL- and Boost-like.
- pan69 9y agoNot sure if there is such a thing but if not, maybe it could be "Stroubie".
- TeMPOraL 9y agoAs in something you could end up in? "Using long arrow operator in production will get you into strouble".
- barsonme 9y agoI think the word is "confusing"
- TallGuyShort 9y agoI was once taught, "In C, calling a solution 'interesting' is a compliment. In Python, that's an insult. Maybe we should go with "interesting".
- skocznymroczny 9y agoundefined behavior
- hinkley 9y agoStroustrupian
- strictfp 9y ago"This is not confusing enough to be considered C++"
- Black-Plaid 9y agoPossibly "Bjarney"
- skj 9y agoThe article where bjarne describes C++ syntax as a joke and programmer job security is a parody. http://www.snopes.com/computer/program/stroustrup.asp http://www.snopes.com/computer/program/stroustrup.asp
- wyldfire 9y agoThe code from the article isn't merely "not idiomatic C++", but I would go so far as to say it's abused or obfuscated C++. An example of non-idiomatic C++ might be for (int I = 0; I < c.size(); I++) { Total += c[I].foo; } ...instead of using std::accumulate. The code from the article is (humorously pointing out) something else entirely.
- marssaxman 9y agoEither you come from a very different community of C++ users than I do, or you are using a different definition of "idiomatic" than I am familiar with, because that loop looks like totally ordinary, everyday C++, and is therefore precisely what I'd call "idiomatic", while I can't recall ever having seen anyone actually use std::accumulate in real life. I suppose this is part of the fun of C++, though, in that it supports a family of distinct but compatible dialects.
- philipov 9y agoPython has zen. Zen is the basis of what is considered pythonic. C++ does not have zen; the language was designed by committee.
- AnimalMuppet 9y agoNot really. C++ was designed by Stroustrup; a committee then modified it somewhat.
- GuB-42 9y agoPython has a strong sense of purity. It is a language that really guides you into doing things one way and the community reflect that. Not so much with C++. There is no one way to do things. Depending on your needs, you will use the language differently. Code focused on performance (ex: game engine) will look very different from server code, or a GUI, or embedded software. And none will be more C++y than the other.