[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug-grep] C or C++? [was: search.c clean-up]
From: |
Tony Abou-Assaleh |
Subject: |
[bug-grep] C or C++? [was: search.c clean-up] |
Date: |
Wed, 24 Nov 2004 14:11:52 -0400 (AST) |
I think the choice of C vs. C++ is more of a matter of preference than
anything else. Though, in some cases, it may also depend on your
objectives.
My personal preference is C. If you know C well, there is little advantage
in switching to C++ (whatever that means, especially that C is a subset of
C++). It is likely that compiler optimizations bring the efficiency of
using C++ features closer to the efficiency of writing them in C for
a specific use. However, keeping up with what's more efficient in C, and
what's as efficient in C++ is tiresome.
I have no problem with switching to C++ if there is a clear advantage for
it. But if the advantage is mostly cosmetic, then I oppose it.
Until about 7 years ago, my position was that all should be written in
assembly (this is not to say that I wrote all in assembly .. I didn't
care about efficiency THAT much for my apps :O) ).
But now that compilers are so good, there is no point. (there was little
point at that time, but almost none at the current time.)
Cheers,
TAA
--------------------------------------------------
Tony Abou-Assaleh
Ph.D. Candidate, Faculty of Computer Science
Chair of the Dalhousie Student Chapter of the ACM
Dalhousie University, Halifax, NS, Canada, B3H 1W5
Fax: 902-492-1517
Email: address@hidden
WWW: http://www.cs.dal.ca/~taa/
---------------------[THE END]--------------------
On Wed, 24 Nov 2004, Elliott Hughes wrote:
> > A separate issue is making the decision as to which apps are worth
> > rewriting in C++, vs. just pushing forward with what's there. E.g.,
> > I dunno that I want to put a lot of time into redoing gawk in C++.
> > Grep is a smaller program, though.
>
> it's not like the whole program would need rewriting. that's the
> advantage of Stroustrup's compatibility tradeoffs: we can just rewrite
> bits as they cause us trouble or are getting rewritten anyway for other
> reasons.
>
> RAII is reason enough to use C++ on any program more complicated than
> /bin/true.
>
> --
> http://www.jessies.org/~enh/
>
>
>
>
- Re: [bug-grep] search.c clean-up, (continued)
- Re: [bug-grep] search.c clean-up, Julian Foad, 2004/11/22
- Re: [bug-grep] search.c clean-up, Jim Meyering, 2004/11/23
- Re: [bug-grep] search.c clean-up, Elliott Hughes, 2004/11/23
- Re: [bug-grep] search.c clean-up, Jim Meyering, 2004/11/23
- Re: [bug-grep] search.c clean-up, Elliott Hughes, 2004/11/24
- Re: [bug-grep] search.c clean-up, Jim Meyering, 2004/11/24
- Re: [bug-grep] search.c clean-up, Elliott Hughes, 2004/11/24
- Re: [bug-grep] search.c clean-up, Paul Eggert, 2004/11/24
Re: [bug-grep] search.c clean-up, Aharon Robbins, 2004/11/24
Re: [bug-grep] search.c clean-up, Paul Eggert, 2004/11/26