[15.12] How can I open a stream in binary mode? FAQ: Open the stream with the std::ios::binary flag. That way, the stream will not translate between '\n' and the target platform representation of line termination, which may be different (for instance, Windows uses CRLF). FQA: With fopen, pass the "b" character in the options string. This whole issue is pretty annoying, especially if you work with binary files on a system where '\n' is not actually translated, and forget to open them as binary, and everything works, and then you port the program to a system where '\n' actually is translated, and then you have to find all those cases and open the files as binary. However, this is not the fault of C++. It is the fault of the distributed nature of the human race, which fails to standardize the simplest things. Many programs may screw up your binary files due to this family of issues, for instance, many FTP clients will do so unless explicitly told otherwise. [11.4] Can I overload the destructor for my class? FAQ: No. Destructors never have parameters or return values. And you're not supposed to call destructors explicitly, so you couldn't use parameters or return values anyway. FQA: Why do you want to overload destructors? Do you like C++ overloading? Are you sure? But the lack of return values is a pity - no way to handle errors. Let's hope they won't happen, shall we? [33.9] I need something like function-pointers, but with more flexibility and/or thread-safety; is there another way? FAQ: A functionoid is what you need. FQA: "Functionoid" rhymes with "marketroid", and is a term local to the FAQ, used instead of the standard term "functor". |
FQA: Why do you want to overload destructors? Do you like C++ overloading? Are you sure? But the lack of return values is a pity - no way to handle errors. Let's hope they won't happen, shall we? |
|
|
|
|
[6.2] Is C++ a perfect language? FAQ: No, and it shouldn't be, it should be practical, which, as we've just seen, it is. Perfect is for academy, practical is for business. FQA: No language is "perfect" because our requirements from a "perfect" language are inconsistent with each other. So instead of perfection, good languages provide consistency and usability. This can be called "practical" from the point of view of language users. C++ is different - it's designed for perfection. |
Where other languages give you a feature, C++ gives you meta-features. Instead of built-in strings and vectors, it gives you templates. Instead of garbage collection, it gives you smart pointers. |
It actually isn't designed for perfection, as the FAQ he just quoted stated, and as numerous documents and articles written by the developers have stated. |
This is actually the focal point for most of his arguments. He simply fails to (or refuses to) acknowledge that C++ is a lower level language than the languages he likes to compare it to, and thus doesn't serve the same purpose. |
Of course if string and vector were built in types, he would complain that there's no benefit in them being built in types, and all it does is make the language more complicated. |
And it is clear that his biases regularly override any objective, professional programming experience |
Try to do one, for e.g. Java or Scala. You will probably run out of ideas after 5 or 10 points. |
I have over 5 years of commercial C++ programming and I agree with most of the FQA claims |
... but, anyway, you don't have a <X>-FQA for any other language. |
Again: so? Things that are big, visible, iconic, oft used, etc always get the most crap. |