7 ms·
There is nothing to "figure out". You are putting up a false narrative that this is at all a big problem in C++. You'll have to do more work than that if you wa
by ksk 10y ago
There is nothing to "figure out". You are putting up a false narrative that this is at all a big problem in C++. You'll have to do more work than that if you want anyone to seriously believe such an outlandish claim. The only reason such syntax bugs become popular is because because C++ has a sizable chunk of the complexity-loving developer populace who are attracted to such things. The vast majority of C++ developers have never even thought about such complexities because they don't need to. In much the same way nobody really sits and thinks how weird it is that 1 == '1' is true in JS, or how you can assign an undefined variable to itself in ruby, etc etc.
- seanwilson 10y agoObviously this is very hard to quantify but for me the cognitive overload of being a good C++ is massively higher than for languages like Java, Python or JavaScript. C++ to me clearly has significantly more undefined behaviour, compiler specific behaviour and other quirks along with less safety nets (e.g. garbage collection, null pointer checks). Do you really find JavaScript, Ruby, Java and Ruby harder to master than C++?
- ksk 10y agoThe blog post was about a possible bug in the syntax/standard itself. I pointed out that all languages have weird edge cases and buggy syntax. If you want to discuss programming languages in general then that is a totally separate discussion. C++ is not in the same class of languages as JS or Ruby, so why would you use them interchangeably? C++ is meant for low level system programming, when performance or size are constraints on the problem you're trying to solve. The problem domain itself entails a certain amount of care. Also, JS and Ruby are indeed just as hard to master as C++. Heck even Bash is hard to master. Case in point. http://codegolf.stackexchange.com/questions/tagged/code-golf http://codegolf.stackexchange.com/questions/tagged/code-golf
- seanwilson 10y agoMy comment started with "C++ FAQs are full of massively complex conundrums like this for problems you just don't get in other languages" so I was making a general comment prompted by the article. > C++ is meant for low level system programming, when performance or size are constraints on the problem you're trying to solve. The problem domain itself entails a certain amount of care. Agree with this but my view is you should avoid C++ at all costs if practical because of its productivity and bug risk impacts compared to other solutions. If low level is required though your options are limited. > Also, JS and Ruby are indeed just as hard to master as C++. We'll have to agree to disagree then because C++ is an order of magnitude more complex in my eyes. Code golf isn't a good metric to me as that's all about using obscure tricks to write as few characters as possible which isn't how you code normally. I would rather measure how easy it is to write code with minimal bugs and C++ gives you a million ways to shoot yourself in the foot.
- ksk 10y agoIMO, Code golf is an excellent metric. Only someone who masters a language and knows its weird edge cases and obscure syntax can make sense of the answers, or attempt to present an answer themselves. If writing code with minimal bugs is your goal, then you don't need to master the language at all. So, I don't even know what we're arguing about. Looks like we agree on most things. So lemme ask you, can you name books (or courses) that teach C++, and devote a significant chunk (or any) of the material to cover such arcane syntax topics? Yes, C++ is complex, because the underlying hardware is complex - and you want to get as close to the hardware as possible. After all, you're basically signing up to repair and service the car yourself, versus bringing it in at the dealership.
- seanwilson 10y ago> IMO, Code golf is an excellent metric. Only someone who masters a language and knows its weird edge cases and obscure syntax can make sense of the answers, or attempt to present an answer themselves. To me, mastering a language is knowing how to use it in a way to solve a problem in the fastest development time with minimal bugs and maintainable code which does not match up with code golf. C++ gives you lots of ways to introduce weird bugs which isn't something code golf demonstrates. > So lemme ask you, can you name books (or courses) that teach C++, and devote a significant chunk (or any) of the material to cover such arcane syntax topics? The C++ Programming Language book and Effective Modern C++ are good and they're full of "don't do this or something bad will happen!" parts. I'm not really concerned about a few arcane syntax problems but I am concerned that C++ has a lot of undefined behaviour that lets you shoot yourself in the foot in a way that other languages avoid.
- zebraska 10y agoI agree with most of your post. The domain of C++ and JS are widely apart. Comparing C++ and JS is hardly justified, IMHO. However if we were to compare them: > Also, JS and Ruby are indeed just as hard to master as C++. I have to call Bull on this part, with apologies for the tone (but I don't know any better way to put it). How on earth you can claim JS is harder than C++? C++ is doubtlessly a much more complicated language than JS, and for good reasons (albeit a good portion of those are historical). However sub-optimal JS is (for it was designed with hardly any gestation time and on a ridiculously tight schedule), it can be taught, almost completely in a matter of hours (sans the DOM). Add a couple more hours for teaching browser security models and pointers on where to find docs for everything JS.
- ksk 10y ago>How on earth you can claim JS is harder than C++? Because I didn't? Please re-read. I said any language is just as hard to master since the earlier context was obscure dark corners of C++ syntax (Which was the general topic of the article. The vast majority of C++ programmers would never have run into that syntax bug). JS has obscure syntax and my argument is that you need to expend equal effort to master it.
- ansgri 10y agoI really find Python harder to master than C++: in C++ you sometimes have to grapple with syntax and development tools, but after it's resolved, your program works predictably, just don't forget to enable debug symbols and core dumps in release builds. Resources are allocated and freed deterministically, the memory requirements are often obvious from code down to some additive, not multiplicative, constant. Granted, I mostly work on embedded image processing systems, but would use C++ in any context where long-running processes and/or low latencies are required. On a more subjective note, I'm waiting for .NET Core to mature a bit, since C# seems to have a balanced selection of features from managed and native worlds, plus a very pleasant syntax and tool support.
- paulddraper 10y ago> nobody really sits and thinks how weird it is that 1 == '1' is true in JS I beg to differ https://www.google.com/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=javascript%20equality https://www.google.com/webhp?sourceid=chrome-instant&ion=1&e...
- ksk 10y agoSorry, I don't quite understand what your point is. You will have to be more clearer than posting a link as a reply to an obvious use of a rhetorical device. But if that was the extent of the reply then you will have to excuse me from any pedantic argument.