> That's not the end of the story; for example, testing the
> validity of a stream against NULL is nonsensical, whereas
> using it as a Boolean type makes perfect sense. (Also, the
> "C++ crowd" can easily avoid these subtle pitfalls, simply
> by not using any of the techniques mentioned in the
> article. Raw pointers can most certainly be tested against
> NULL without it [although the terser test is also allowed
> in this fine language!].)
Well, it is a problem in C++ that there are not standard libraries handling I/O streams with all the associated member methods for asking questions like isEof(), availCount() etc. These make much more sense than
if( iostream ) {
...
}
which for old C developers would mean
is this initialized. It just makes little sense to keep pressing this programming expression given all the history and confusion that persists.
> It's not really that hard in C++:
>
> SomeClass sc1,sc2;
> // Equality of objects
> if (sc1==sc2) {}
> // Equality of storage location
> if (&sc1==&sc2) {}
But, then someone has to remember to define the operator overload for the associated types.
> For some problems, I agree that there are languages more
> suitable than C++. On the other hand, the power,
> expressiveness, beauty, and the language's support for
> unrestrained creativity are, in my opinion, outstanding
> virtues of C++ that make me appreciate _my_ choice. As
> always, your mileage may vary...
For a lot of people, they get to express nonsensical expressions that make sense to them, but which add any real value to the software system that they are constructing.
I'd guess there might be some lazy typing issues, and perhaps some inability to type either due to training or physical issues. I do have sympathy for those that don't like to, or can't type. But, it is an issue that needs to be dealt with for all programming environments.