3 ms·
Looks like another frustrated basic programmer... Yes, C++ will let you make mistakes. It's not your nanny, it's a programming tool for... GASP ...programmer
by fredsanford 13y ago
Looks like another frustrated basic programmer...
Yes, C++ will let you make mistakes. It's not your nanny, it's a programming tool for... GASP ...programmers...
Let's see if we can get ACTOR resurrected...
- Pxtl 13y agoThis kind of gotcha really should be a warning at default warning level.
- okey 13y agoThe problem with a default warning for signed/unsigned comparison is there are many cases of this in large existing codebases where, although it is not ideal, it doesn't do any harm. Such cases could constitute a large amount of compiler warning output - obviously just making life difficult for maintainers. Personally I always use -Wextra (the relevant flag for clang) when working on my own code.
- fredsanford 13y agoHow can a compiler warn you that your thinking is wrong unless that thinking breaks some language rule or does something worth warning you about? The problem presented in the article is not well thought out and cannot be achieved with these instructions: Write down your name. Make a pile of pennies with as many pennies as there are letters in your name. Keep doing this: Write down an 'X' Remove one of the pennies as long as the number of pennies is less than the number of letters in your name. So, outside of being a mind-reader how is a C++ compiler supposed to correct _your_ thinking?
- PhasmaFelis 13y agoA lot of people seem to be hung up on the specific word problem he used. That's not really the point. The point is, if you do this: int foo = -1 unsigned int bar = 1 then "foo > bar" evaluates true. And it shouldn't, because that makes no sense. Languages should not violate the Principle of Least Surprise unless there's a really good reason.
- PhasmaFelis 13y agoAnd speaking of the Principle of Least Surprise, I'm curious as to why HN's comment system handles double newlines like a comment system, but single newlines like an HTML parser.
- rybosome 13y agoThis guy is recounting struggles teaching beginners to program, not his own difficulties. There's no reason to assume he's a basic programmer. He's also not calling C++ a bad language, merely saying that it's frustrating teaching it to newbies - what's wrong with that? Even though he wasn't ragging on C++ as a general-purpose programming language, it would be nice if the programming community could have honest conversations about its shortcomings without resorting to defensive, ad-hominem attacks.
- derleth 13y ago> Yes, C++ will let you make mistakes. It's not your nanny, it's a programming tool for... GASP ...programmers... Yes, assembly will let you make mistakes. It's not your nanny, it's a programming tool for... GASP ...programmers... So, therefore, C++ is equal to or less than BaSUCK and yer a silly-nanny like yer old man.
- bcoates 13y agoIf you managed to get through a formal programming education without successfully writing a program in an assembly language, ask for your money back.
- derleth 13y agoMy point is that analyzing languages on that basis is silly. I thought the rest of my post was silly enough to demonstrate that.
- lelandbatey 13y agoI wouldn't describe it as "C++ lets you make mistakes." I'd instead say that "C++ exposes you to the artifacts and edges that are part of the raw computer system." I say this because it's a lot less dismissive of the troubles of the programmer to be. I remember being new not so long ago, and being frustrated immensely by the dismissals of experienced C++ programmers who feel that programming is inherently all about knowing and dealing with the hard edges of the machine, and much less about the rather beautiful theoretical side most people would call Computer Science. And I feel that's pretty much wrong; that programming is a balance between wrangling the machine and building elegant, beautiful logical constructions. Covering both sides separately is important, and builds a strong programmer. Teaching only one side, or not acknowledging the differences between these two very separate skills/processes confuses aspiring programmers tremendously, and turns them away from the tremendous power that can be had in languages like C++.