C++ Frequently Questioned Answers
flag
Messages 41 - 50 of 261 - Collapse all
/groups/adfetch?hl=en&adid=6LTXchIAAAArUbKt87EmLRUNMius-lo4A-seRgWUrY1Re68AkUbKNw
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
241.  ap...@student.open.ac.uk  
View profile  
 More options Oct 30 2007, 2:41 pm
Newsgroups: comp.lang.c++.moderated
From: ap...@student.open.ac.uk
Date: Tue, 30 Oct 2007 06:41:41 CST
Local: Tues, Oct 30 2007 2:41 pm
Subject: Re: C++ Frequently Questioned Answers
On 26 Oct, 08:27, Yossi Kreinin <yossi.krei...@gmail.com> 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.

> The FQA is fairly large (about half the size of the FAQ).

Yes it is. In order to make it easier to navigate could you put fwd
and backward arrows on each page please? A top button would be useful
as well.

I realise that alot of work has gone into this so please don't take
this the wrong way: after reading for a bit it seems to me like a long
rant against C++. I think many of the criticisms are valid but are
phrased in an aggressive way. It makes it  appear the people
responsible for C++ are stupid or irresponsible, which IMO is not the
case.

Would you be ammenable to suggestions from this NG that would tone
some of the entries down a bit?

-Andrew Marlow

--
      [ See http://www.gotw.ca/resources/clcm.htm for info about ]
      [ comp.lang.c++.moderated.    First time posters: Do this! ]


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
242.  Yossi Kreinin  
View profile  
(2 users)  More options Oct 30 2007, 9:51 pm
Newsgroups: comp.lang.c++.moderated
From: Yossi Kreinin <yossi.krei...@gmail.com>
Date: Tue, 30 Oct 2007 13:51:17 CST
Local: Tues, Oct 30 2007 9:51 pm
Subject: Re: C++ Frequently Questioned Answers
On Oct 30, 2:41 pm, ap...@student.open.ac.uk wrote:

> I think many of the criticisms are valid but are
> phrased in an aggressive way. It makes it  appear the people
> responsible for C++ are stupid or irresponsible, which IMO is not the
> case.

About "aggression": http://yosefk.com/c++fqa/faq.html#faq-6
As the disclaimers section states, I didn't want to personally offend
anybody.

> Would you be ammenable to suggestions from this NG that would tone
> some of the entries down a bit?

Definitely, if you can point out the places which make actual people
appear stupid or make any derogatory statements (maybe e-mail is a
better way to talk about the details). I will probably not remove the
claims about how marketing forces shaped C++ (which I think are the
fiercely phrased ones), because of quotes like this (http://
www.research.att.com/~bs/dne.html):

"Within C++, there is a much smaller and cleaner language struggling
to get out," which he says "would ... have been an unimportant cult
language."

.../and/ of course because of quotes like this (http://
www.research.att.com/~bs/bs_faq.html#C++success):

"the chance of success was affected by marketing clout, which I did
not have."

P.S. I'll try to answer the rest of the meaningful criticism in the
evening (I've quit all online discussions in non-moderated newsgroups
though). I'm publishing factual corrections at this page (which also
has my definition of "factual" in this context):

http://yosefk.com/c++fqa/web-vs-fqa.html

If you want to get a reply from me, e-mail is the most effective way:
http://yosefk.com

-- Yossi

--
      [ See http://www.gotw.ca/resources/clcm.htm for info about ]
      [ comp.lang.c++.moderated.    First time posters: Do this! ]


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
243.  LR  
View profile  
 More options Oct 31 2007, 3:58 am
Newsgroups: comp.lang.c++.moderated
From: LR <lr...@superlink.net>
Date: Tue, 30 Oct 2007 19:58:23 CST
Local: Wed, Oct 31 2007 3:58 am
Subject: Re: C++ Frequently Questioned Answers

Yossi Kreinin wrote:
> The C++ FQA Lite is available here: http://yosefk.com/c++fqa

I haven't read the whole thing, but what I have read seems very interesting.

But I'm not quite sure that I understand the point you're trying to make.

The FQA contains at least one FAQ (in the literal sense, rather than the
sense that FAQ is used for Answers to Frequently Asked Questions), in
FQA 23.6 http://yosefk.com/c++fqa/inheritance-mother.html#fqa-23.6
"How about trying another programming language?"

Could this be what you're driving at?  If so, what do you have in mind?

LR

--
      [ See http://www.gotw.ca/resources/clcm.htm for info about ]
      [ comp.lang.c++.moderated.    First time posters: Do this! ]


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
244.  Yossi Kreinin  
View profile  
(1 user)  More options Nov 1 2007, 8:36 pm
Newsgroups: comp.lang.c++.moderated
From: Yossi Kreinin <yossi.krei...@gmail.com>
Date: Thu, 1 Nov 2007 12:36:59 CST
Local: Thurs, Nov 1 2007 8:36 pm
Subject: Re: C++ Frequently Questioned Answers
On Oct 31, 3:58 am, LR <lr...@superlink.net> wrote:

> "How about trying another programming language?"

> Could this be what you're driving at?  If so, what do you have in mind?

This is exactly what I'm driving at. The language choice depends on
your application domain, organizational constraints and personal
taste, and discussing this seems off-topic here. A partial list of
languages I refer to when I speak about useful things C++ doesn't have
(or problematic things other languages haven't) is here:

http://yosefk.com/c++fqa/disclaimers.html

One particular thing that AFAIK applies almost always: low-level work
is better done in C than C++. I speak from lots of experience (but it
doesn't matter - what matters is whether my points in the FQA convince
you or not). By "low-level", I mean "when your resources are really
scarce" (compared to the "size" of the problem).

--
      [ See http://www.gotw.ca/resources/clcm.htm for info about ]
      [ comp.lang.c++.moderated.    First time posters: Do this! ]


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
245.  ap...@student.open.ac.uk  
View profile  
(1 user)  More options Nov 6 2007, 9:44 pm
Newsgroups: comp.lang.c++.moderated
From: ap...@student.open.ac.uk
Date: Tue, 6 Nov 2007 13:44:37 CST
Local: Tues, Nov 6 2007 9:44 pm
Subject: Re: C++ Frequently Questioned Answers
On 1 Nov, 18:36, Yossi Kreinin <yossi.krei...@gmail.com> wrote:

> One particular thing that AFAIK applies almost always: low-level work
> is better done in C than C++. I speak from lots of experience (but it
> doesn't matter - what matters is whether my points in the FQA convince
> you or not). By "low-level", I mean "when your resources are really
> scarce" (compared to the "size" of the problem).

Hmm, this is interesting. I recently did some work on a java project
where I had to interface to a third-party library written in C. I used
SWIG to create a JNI wrapper which has enabled the project to be
rewritten in java. There was poor encapsulation in the lib and various
other issues so I wrote a layer above this lib. I chose to write that
layer in C which is then SWIG'd. But the reason was not due to the low
level work. It is true that some might consider the work to be low-
level, e.g use of UNIX pipes, multiple socket select, POSIX condition
variables and so on but there are several C++ libs that provide nice
wrappers for these (ACE, Boost, Poco etc etc). I didn't use them
because the project was trying to get rid of C++. I managed to keep
the wrapper small enough that the project now has no C++ complexities
because there is no C++. Using them would have made things smaller and
easier in some places.

For example where I used POSIX mutexes it would have made for shorter
simpler C++ if I used RAII. Instead in C I had to be more careful and
tended to use goto's to jump to cleanup code on errors. This made the
code longer and of course, meant was using the dreaded goto. This lost
opportunity to use RAII is probably what David Abrahams was referring
to when he said his code was typically shorter and simpler in C++.

So I wonder why you would chose C. I did because of special project
needs, what are your reasons please? Why is the scarcity of resources
an issue here?

Regards,

Andrew Marlow

--
      [ See http://www.gotw.ca/resources/clcm.htm for info about ]
      [ comp.lang.c++.moderated.    First time posters: Do this! ]


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
246.  Yossi Kreinin  
View profile  
(1 user)  More options Nov 7 2007, 2:42 am
Newsgroups: comp.lang.c++.moderated
From: Yossi Kreinin <yossi.krei...@gmail.com>
Date: Tue, 6 Nov 2007 18:42:40 CST
Local: Wed, Nov 7 2007 2:42 am
Subject: Re: C++ Frequently Questioned Answers
On Nov 6, 9:44 pm, ap...@student.open.ac.uk wrote:

> So I wonder why you would chose C. I did because of special project
> needs, what are your reasons please? Why is the scarcity of resources
> an issue here?

I don't know what I'd do in this case since I don't really know the
case. The ultimate purpose seems to be to write a thin layer of glue
code between existing C and Java code; you can't really do it "really
wrong" since it's a small thing.

I could prefer C because it would compile in a snap (I never use
Boost.Python since it takes forever to compile - python.org cites this
close to the front page), and the verbose code (wrapping "tricky"
things like mutexes) would at least be very clear, and in C++ this
isn't really the case (I don't think I can convince you here and vice
versa, it's largely a matter of taste and experience of each person).

And I wouldn't introduce a third language, especially a tricky one
like C++ (which could throw exceptions that C couldn't deal with and/
or require initialization before main and finalization after main that
wouldn't necessarily work in the already multilingual environment and/
or there might be dynamic libraries involved and then C++ type_info
objects may end up being instantiated twice, etc.) I saw what happens
when you have Ada and C++ in the same process (didn't manage to figure
out why it crashed in _exit).

But then again, I don't know what I'd do in your case, since I don't
really know it. It doesn't seem to deal with "low-level work" by
itself though, it's a very special issue, "linguistic" at the very
core (mixing C and Java).

--
      [ See http://www.gotw.ca/resources/clcm.htm for info about ]
      [ comp.lang.c++.moderated.    First time posters: Do this! ]


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
247.  David Abrahams  
View profile  
(2 users)  More options Nov 7 2007, 2:45 am
Newsgroups: comp.lang.c++.moderated
From: David Abrahams <d...@boost-consulting.com>
Date: Tue, 6 Nov 2007 18:45:24 CST
Local: Wed, Nov 7 2007 2:45 am
Subject: Re: C++ Frequently Questioned Answers

on Tue Nov 06 2007, apm35-AT-student.open.ac.uk wrote:

> This lost opportunity to use RAII is probably what David Abrahams
> was referring to when he said his code was typically shorter and
> simpler in C++.

It was someone else, but I've had the same experience.  A combination
of C++ features (mostly operator overloading, templates, and inlining)
make it possible to have abstraction without time and space penalties.
To get equivalently-efficient use of resources in 'C' requires
(sometimes complete) loss of abstraction, resulting in messy,
hard-to-write, hard-to-maintain, incorrect code that sometimes is even
less efficient than the equivalent C++.  I can cite many examples, but
here are two:

     * High-performance math: expression templates allow optimal
       implementations of complex matrix calculations while maintaining
       readable syntax.  The simplest example is summing an arbitrary
       set of matrices (known at compile-time) without creating any
       temporary matrices.

          Matrix sum = a + b + c ... ;

       The optimal code walks the summed matrices in parallel, placing
       the sums of each corresponding element into the result.

       The equivalent 'C' is bigger, uglier, and even if you manage to
       write a library routine that does it just as efficiently for
       this case, when you add one more matrix to your sum, you have to
       rewrite the library to maintain performance (so naturally you
       sacrifice performance).  The operations involved in a realistic
       case aren't limited to +, and even introducing '-' creates a
       combinatorial explosion of possible computations so there's no
       way to hardcode a C library that can do the computation
       optimally.

     * The Python interpreter is written in 'C' and uses
       reference-counting as part of its garbage-collection scheme.
       Not having the smart pointer abstraction available to manage the
       reference counting is a nightmare, and frequently leads to
       mistakes that can be hard to detect and debug.  Furthermore, all
       the manual reference-counting operations account for a great
       deal of syntactic overhead.  The 'C' code is bigger, uglier, and
       more error-prone than the equivalent C++, and no more efficient.

I could go on.  Abstraction without efficiency penalty is key to
writing robust, correct, efficient, sustainable software, and 'C'
doesn't provide nearly the capabilities that C++ does in that
department.

--
Dave Abrahams
Boost Consulting
http://www.boost-consulting.com

      [ See http://www.gotw.ca/resources/clcm.htm for info about ]
      [ comp.lang.c++.moderated.    First time posters: Do this! ]


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
248.  c...@mailvault.com  
View profile  
 More options Nov 8 2007, 11:14 am
Newsgroups: comp.lang.c++.moderated
From: c...@mailvault.com
Date: Thu, 8 Nov 2007 03:14:32 CST
Local: Thurs, Nov 8 2007 11:14 am
Subject: Re: C++ Frequently Questioned Answers
On Nov 6, 6:45 pm, David Abrahams <d...@boost-consulting.com> wrote:

> on Tue Nov 06 2007, apm35-AT-student.open.ac.uk wrote:

> > This lost opportunity to use RAII is probably what David Abrahams
> > was referring to when he said his code was typically shorter and
> > simpler in C++.

> It was someone else, but I've had the same experience.  A combination
> of C++ features (mostly operator overloading, templates, and inlining)
> make it possible to have abstraction without time and space penalties.
> To get equivalently-efficient use of resources in 'C' requires
> (sometimes complete) loss of abstraction, resulting in messy,
> hard-to-write, hard-to-maintain, incorrect code that sometimes is even
> less efficient than the equivalent C++.

[snip]

> Abstraction without efficiency penalty is key to
> writing robust, correct, efficient, sustainable software, and 'C'
> doesn't provide nearly the capabilities that C++ does in that
> department.

OK, and

On Nov 5, 9:08 am, "Alf P. Steinbach" <al...@start.no> wrote:

> * Walter Bright -> Jerry Coffin:

> > If you can speed up g++ template processing, it's open source!

> Yeah, spaghetti K&R C.  I tried to fiddle with it once, and got as far
> as having the compiler accepting some new syntax for exception handling.
>   But based on how much time that took, decided it wasn't worth it.

> I find it amazing that e.g. concept GCC has been implemented.

> I think one must be really dedicated (and perhaps have a /lot/ of free
> time) to do that sort of thing.

How much sense does it make to keep piling new layers on top of
GCC?  I've been of the opinion that it needs to be rewritten in
C++ for 8 or 9 years.  Before embarking on concept GCC I think
it would have made sense to ask, "If not now, when?"
http://www.jewishvirtuallibrary.org/jsource/Quote/hillel2.html

In the short term I can understand the decision, but from a
longer term perspective I'm not convinced it was a good decision.
Now someone down the road is going to have a bigger pile to
clean up than before.  (I'm also impressed with the accomplish-
ment, but I agree with what I quoted above -- things can only
be organized so much with C.)  Biting the bullet seems the only
alternative.  What C++ compilers are developed with older
versions of C++ compilers?

Brian Wood
Ebenezer Enterprises
www.webebenezer.net

--
      [ See http://www.gotw.ca/resources/clcm.htm for info about ]
      [ comp.lang.c++.moderated.    First time posters: Do this! ]


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
249.  David Abrahams  
View profile  
 More options Nov 8 2007, 11:04 pm
Newsgroups: comp.lang.c++.moderated
From: David Abrahams <d...@boost-consulting.com>
Date: Thu, 8 Nov 2007 15:04:54 CST
Local: Thurs, Nov 8 2007 11:04 pm
Subject: Re: C++ Frequently Questioned Answers
on Thu Nov 08 2007, coal-AT-mailvault.com wrote:

> How much sense does it make to keep piling new layers on top of
> GCC?  I've been of the opinion that it needs to be rewritten in
> C++ for 8 or 9 years.  Before embarking on concept GCC I think
> it would have made sense to ask, "If not now, when?"
> http://www.jewishvirtuallibrary.org/jsource/Quote/hillel2.html

That might (or might not) make sense from a "health of GCC"
standpoint, but Doug Gregor, who wrote most of the ConceptGCC
extensions, didn't do it "for the good of GCC;" he did it for the good
of concept support in the C++ language.

--
Dave Abrahams
Boost Consulting
http://www.boost-consulting.com

      [ See http://www.gotw.ca/resources/clcm.htm for info about ]
      [ comp.lang.c++.moderated.    First time posters: Do this! ]


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
250.  c...@mailvault.com  
View profile  
 More options Nov 9 2007, 10:28 am
Newsgroups: comp.lang.c++.moderated
From: c...@mailvault.com
Date: Fri, 9 Nov 2007 02:28:48 CST
Local: Fri, Nov 9 2007 10:28 am
Subject: Re: C++ Frequently Questioned Answers
On Nov 8, 3:04 pm, David Abrahams <d...@boost-consulting.com> wrote:

> on Thu Nov 08 2007, coal-AT-mailvault.com wrote:

> > How much sense does it make to keep piling new layers on top of
> > GCC?  I've been of the opinion that it needs to be rewritten in
> > C++ for 8 or 9 years.  Before embarking on concept GCC I think
> > it would have made sense to ask, "If not now, when?"
> >http://www.jewishvirtuallibrary.org/jsource/Quote/hillel2.html

> That might (or might not) make sense from a "health of GCC"
> standpoint, but Doug Gregor, who wrote most of the ConceptGCC
> extensions, didn't do it "for the good of GCC;" he did it for the good
> of concept support in the C++ language.

I think its likely future endeavors, that are just as pressing
and desired as ConceptGCC, will have a harder time succeeding
as GCC grows bigger than it needs to be.  I acknowledge a short term
gain, but don't think the status quo, C, in GCC is sustainable.  I
guess we'll be able to tell by the quality of
GCC releases going forward.  Its too bad there isn't already a group
in place rewriting the thing.

Brian Wood
Ebenezer Enterprises
www.webebenezer.net

--
      [ See http://www.gotw.ca/resources/clcm.htm for info about ]
      [ comp.lang.c++.moderated.    First time posters: Do this! ]


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2010 Google