Re: C++ Frequently Questioned Answers
Yossi Kreinin wrote:
The C++ FQA Lite is available here: http://yosefk.com/c++fqa
It's based on the comp.lang.c++ FAQ - http://parashift.com/c++-faq-lite
While certainly not off-topic for comp.lang.c++[.moderated], the FQA
can make a flame bait. Apparently, a good way to prevent flame wars is
to have the discussion in a moderated newsgroup (I have a recent
experience with a weakly moderated forum, and it was suboptimal). You
can also e-mail me privately (if you're human, you'll find the address
at the site). One thing I'm definitely interested in is whether I got
any facts wrong, and if I did, which ones.
DISCLAIMER: I haven't read all of your FQA--there is just too many of
Although it seems you did a fair amount of research, to me your post
is not much more than a very sophisticated way of saying "C++ SUCKS"
on a moderated C++ newsgroup. :-)
From your words I can guess that you have had pretty weird experience
with C++ on a large project... and somehow you have expected much of
the "features" the language have never declared to have: garbage
collection, built-in run-time checks, reflection, etc; Features one
would normally expect from a _very_ high level language like Python,
Ruby, Lisp, etc; but not C++.
So basically, instead of blaming yourself (or whoever is responsible)
for poor language/task choice you try to blame C++... Duh!
To be more specific, from http://yosefk.com/c++fqa/defective.html:
"No compile time encapsulation"
This item implies that you have to ship the implementation class
declaration to clients, which is not necessarily true. Have you ever
heard about abstract classes ("interfaces")? (Obviously, this won't
work with templates, but you have to provide the definitions in that
"Outstandingly complicated grammar"
Maybe, you have your point here.
"No run time encapsulation"
See above: no built-in run-time checks.
"No binary implementation rules"
Frankly, I don't see your point here. You have tried to link g++-
compiled libraries with msvc-compiled code, or what exactly?
"Very complicated type system"
I'll quote that a bit to bring in some context:
For example, if your function accepts const std::vector<const
char*>& (which is supposed to mean "a reference to an immutable
vector of pointers to immutable built-in strings"), and I have a
std::vector<char*> object ("a mutable vector of mutable built-in
strings"), then I can't pass it to your function because the types
aren't convertible. You have to admit that it doesn't make any
sense, because your function guarantees that it won't change
anything, and I guarantee that I don't even mind having anything
changed, and still the C++ type system gets in the way and the only
sane workaround is to copy the vector.
Not really. You can rewrite your function into a function template
which will accept a range instead of `std::vector< whatever >&':
template< typename Iter > void func2(Iter begin, Iter end);
Of course, you loose that prominent `const*' in declaration, but as
long as implementation complies with the given pact (not to modify
whatever iterators "point to"), I think it's pretty OK.
Anyway, I don't recall myself applying cv-qualifiers to the type of
contained elements in a sensible and useful way. Anyone?
... Exception safe C++ code is almost infeasible to achieve in a non-trivial program.
Maybe, if you prefer to write everything from scratch instead of
trying to stick to standard library. Personally, I have never had
that kind of problem.
Now... I'm kinda tired writing all that stuff. Do you want me to
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]