3 ms·
C++ is a shitty hairball of a language, sure. BUT. The example the author uses fails to capture a minor nuance of the real world: there is an implicit assumpt
by angersock 13y ago
C++ is a shitty hairball of a language, sure.
BUT.
The example the author uses fails to capture a minor nuance of the real world: there is an implicit assumption that you can't keep removing pennies once you hit zero. Had the pseudo-code been this...
as long as the number of pennies is less than the number of letters in your name *and there are pennies to remove*.
...then the generated C++ conditional would've been:
} while (pennies > 0 && pennies < name.length());
This is more an example of why sloppily converting algos in English to machine-friendly codes is terrible.
- squidfood 13y agoWell that's the point, isn't it. The code is purposefully sloppy and should fail or hang, and the programmer can then fix it like you did. But with c++, it "works", but for the wrong reason, so it never gets fixed and may cause problems someday.
- cbsmith 13y agoSo basically the argument is that Coq is the ideal beginner programming language.
- angersock 13y agoTo quote Charles Babbage: "On two occasions I have been asked, — "Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?" In one case a member of the Upper, and in the other a member of the Lower, House put this question. I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question."