4 ms·
I don't get this... Is he teaching a language he himself doesn't quite understand? (I don't know the author). Or is he complaining that C++ is difficult and tha
by bnastic 13y ago
I don't get this... Is he teaching a language he himself doesn't quite understand? (I don't know the author). Or is he complaining that C++ is difficult and that it should be something it clearly isn't. Implicit conversions, size_t, the way hardware dictates how wrap around zero works... that's all pretty basic stuff i the context of C++. If you know this stuff, you also know that you shouldn't teach it in any sort of introductory CS courses. It's all white noise. Many other languages suffer from similar (sometimes self-inflicted) quirks. He should stick with Scheme.
- sirclueless 13y agoI think a great deal of the pain in this example is self-inflicted. The hardware wrapping of an unsigned integer is fair game, but the multi-layer typedef and conversion to unsigned comparison are both warts of C++ that are totally avoidable. The multi-layer typedef is just the nature of enormous libraries with multitudinous compatibility concerns, so it's possible to forgive even that (and tools will help you there). But most reasonable languages won't let the assignment from unsigned int to int happen, and won't let the comparison happen either.
- bnastic 13y agoThe whole size_type <-> size_t malarkey is thanks to STL's gremlins, but that's beyond the point. Every compiler nowadays will emit a warning about comparing/assigning signed and unsigned integers (that can be promoted to an error if need be), as someone's comment already mentioned, which should be enough (not that the C++ warnings are always obvious or easy to parse mentally).