By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,330 Members | 1,523 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,330 IT Pros & Developers. It's quick & easy.

C or C++ something else....

P: n/a
Thanks for your answers.
I already know programming in Java and I am starting studying the
perl. I would like to learn C or C++ but I need someone to tell me
the + and - of each one. I have noticed that every computer exploit
and almost every linux program is builted in C why is that? Because
they just know to program in C or C is better for that kind of
programs and why? Can somebody give an example of big project that
you can achive with C and you cant with C++ or vice versa? Also can
somebody suggest me a book for both of them ! (I dont want something
for begginers i want something to be as much complete book as it can
be, with all the topics you need to know for a programming language
.)Sorry for the number of the questions but i am a little bit
confused.
Thanks one more time

--
--------------------------------- --- -- -
Posted with NewsLeecher v3.7 Final
Web @ http://www.newsleecher.com/?usenet
------------------- ----- ---- -- -

Sep 29 '06 #1
Share this Question
Share on Google+
61 Replies


P: n/a
Big-Goofy wrote:
Thanks for your answers.
I already know programming in Java and I am starting studying the
perl. I would like to learn C or C++ but I need someone to tell me
the + and - of each one.
I hope you're not blind and should see the two pluses in C++... I
don't see any minuses there, do you? Neither does C have any minuses.
It just doesn't have any pluses, that's all.
I have noticed that every computer exploit
Is that what you're trying to get into?
and almost every linux program is builted in C why is that? Because
they just know to program in C or C is better for that kind of
programs and why? Can somebody give an example of big project that
you can achive with C and you cant with C++ or vice versa?
Find Bjarne Stroustrup's home page and read all of it.
Also can
somebody suggest me a book for both of them ! (I dont want something
for begginers i want something to be as much complete book as it can
be, with all the topics you need to know for a programming language
.)Sorry for the number of the questions but i am a little bit
confused.
Just Google for book suggestions. It's getting really old. Show us
that you're ready to learn either of the languages by applyting some
effort to collecting information.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Sep 29 '06 #2

P: n/a
Big-Goofy wrote:
I already know programming in Java and I am starting studying the
perl.
I have used Perl for years, and come to the conclusion that its author,
Larry Wall, must be a very fast, accurate typist.

Download Ruby to see how clean and elegant a language can get!
I would like to learn C or C++ but I need someone to tell me
the + and - of each one. I have noticed that every computer exploit
and almost every linux program is builted in C why is that?
Roughly speaking, C is older and more Standard, so it has a much bigger
establish corpus of legacy code. Including Linux. By "more Standard" I mean
that more Standard-compliant code has been written to work in more
Standard-compliant compilers than C++.

(I suspect we still don't have a standard-conforming compiler, despite
almost a decade of a ratified Standard. And I suspect that the committees
are upgrading this Standard before it even achieves compliance!!)

Entry level programmers don't need to worry about any of that. Learn C++
first, and learn enough C to diagnose and debug it. Learn C++ as a
high-level language, starting with features like std::string. Then learn C
things like strlen(), so you can avoid the troubles these cause.
Because
they just know to program in C or C is better for that kind of
programs and why?
Anything you can do in C, you can do the same way, with better typesafety
and more conveniences, in C++.

Almost anything you can do in C, you can do better in C++ using Object
Oriented, Generic, and similar paradigms.

The only thing you can't do is the very last step of optimization. Kernels
like Linux's need that (and you _don't_), so they must use C-style code. C++
can compile C-style code, so they still don't need C.

Most C code can be tweaked to compile in C++. But Linux shouldn't compile as
C++ because Linux works on many kinds of CPU hardware, and some of them
don't have C++ compilers. Only situations without a C++ compiler strictly
need C.
Can somebody give an example of big project that
you can achive with C and you cant with C++ or vice versa?
C++ is better for very large projects because it allows you to create
modules and components better than C. C has poorer support for
encapsulation, which is a good high-level technique to prevent bugs.
Also can
somebody suggest me a book for both of them ! (I dont want something
for begginers i want something to be as much complete book as it can
be, with all the topics you need to know for a programming language
.)
Tip: Most programming today should not be in a C language at all. It should
be in a soft rapid language (like Ruby or Python) where you don't need to
reinvent the wheel all the time.

To proceed in C++, read /The C++ Programming Language, 3rd Edition/ by
Bjarne Stroustrup. It fits the "complete" spot you requested.

--
Phlip
http://www.greencheese.us/ZeekLand <-- NOT a blog!!!
Sep 29 '06 #3

P: n/a
Phlip wrote :
Roughly speaking, C is older and more Standard, so it has a much bigger
establish corpus of legacy code. Including Linux. By "more Standard" I mean
that more Standard-compliant code has been written to work in more
Standard-compliant compilers than C++.
AFAIK, there is only one frontend which is compliant to the latest C
standard, just like for C++.
And it's the same one, actually.

The only thing you can't do is the very last step of optimization. Kernels
like Linux's need that (and you _don't_), so they must use C-style code. C++
can compile C-style code, so they still don't need C.
Not really.
A lot of notable C++ features are not only acceptable in a kernel but
can also boost its performance and improve its design.

Sep 29 '06 #4

P: n/a
loufoque wrote:
>The only thing you can't do is the very last step of optimization.
Kernels like Linux's need that (and you _don't_), so they must use
C-style code. C++ can compile C-style code, so they still don't need C.

Not really.
A lot of notable C++ features are not only acceptable in a kernel but can
also boost its performance and improve its design.
Oops; right. I was trying too hard to say "C++ is always better than C, even
for C-style optimization" that I forgot about "C++-style optimization".

An OS kernel built out of a sick "expression metatemplate" package, taking
hours to compile, would shred!!!

And would still be maintainable, unlike the raw Assembly it would compete
with.

--
Phlip
http://www.greencheese.us/ZeekLand <-- NOT a blog!!!
Sep 29 '06 #5

P: n/a
Phlip wrote:
<...>
Most C code can be tweaked to compile in C++. But Linux shouldn't compile as
C++ because Linux works on many kinds of CPU hardware, and some of them
don't have C++ compilers. Only situations without a C++ compiler strictly
need C.
re: Linux, AFAIK Linus Torvalds just plain doesnt like C++, and that
is the beginning and end of the matter. Theres an interview or quote
somewhere... but where I don't know.

regards
Andy Little

Sep 29 '06 #6

P: n/a
kwikius wrote:
Phlip wrote:
<...>
>Most C code can be tweaked to compile in C++. But Linux shouldn't compile as
C++ because Linux works on many kinds of CPU hardware, and some of them
don't have C++ compilers. Only situations without a C++ compiler strictly
need C.

re: Linux, AFAIK Linus Torvalds just plain doesnt like C++, and that
is the beginning and end of the matter. Theres an interview or quote
somewhere... but where I don't know.
Linux, fortunately, has gone way beyond the personal whims of Linus.
Just about every implementation of Linux I've seen uses the GCC suite
for it's compilers which pretty much comes with both C and C++. The
few exceptions also provide C++ environments.

There's no trememdously compelling reason to NOT allow C++ in the
kenrel. There are user-mode programs in LINUX that are written in
C++ (and a bunch of them like the X libraries would fare better had
they been written in a real object-oriented language rather than a
half-assed attempt to implement OO concept in strict C.
Sep 29 '06 #7

P: n/a
kwikius wrote :
re: Linux, AFAIK Linus Torvalds just plain doesnt like C++, and that
is the beginning and end of the matter. Theres an interview or quote
somewhere... but where I don't know.
Did you mean this quote ? (It's from 2004 I think)
You can obviously see he doesn't know C++ well and that moreover he does
nothing more than insult C++ and the people that use it.

[Beginning of quote]

The fact is, C++ compilers are not trustworthy. They were even worse in
1992, but some fundamental facts haven't changed:

- the whole C++ exception handling thing is fundamentally broken. It's
_especially_ broken for kernels.
- any compiler or language that likes to hide things like memory
allocations behind your back just isn't a good choice for a kernel.
- you can write object-oriented code (useful for filesystems etc) in C,
_without_ the crap that is C++.

In general, I'd say that anybody who designs his kernel modules for C++ is
either
(a) looking for problems
(b) a C++ bigot that can't see what he is writing is really just C anyway
(c) was given an assignment in CS class to do so.

[End of quote]
Sep 29 '06 #8

P: n/a
va*****@hotmail.com wrote:
>>Thanks for your answers.
I already know programming in Java and I am starting studying the perl.
I would like to learn C or C++ but I need someone to tell
me the + and - of each one.
So you want to learn C or C++. (thank God, you did not ask C/C++ ).

Q: do you want to eat an apple or an orange?

A: http://www.parashift.com/c++-faq-lite/ &
http://www.research.att.com/~bs/papers.html

C & C++ are different lanugaes. you do not need to post it here, do
these 4 things:

1.) First, write down your goals & plan of your career, where & why you
want to go & in which direction (you know "software world" has many
domains or application areas)

2.) Search for jobs you want on your faourite (but also popular) job
site. i like "www.monsterindia.com" (as i live in India)

3.) after collecting the information from last 2 points, now, search
the archives of 4 newsgroups "comp.lang.c", "comp.lang.c++",
"comp.lang.c++.moderated" & "alt.comp.lang.learn.c-c++" with following
keywords: "c or c++", "why c++", "why c" etc. etc. then read all the
information. If you have a printer(like me, i have a dot-matrix :-),
then take print-outs of things which seem important from the
perspective of information you collected from points 1 & 2.

4.) know that its 14th day since you started from point 1.

this will 1st, remove the "fog of confusion" & 2nd, you will get a much
better, an accurate & focused answer.

actually i was pondering into the same confusion & i relieved my pain
in the same way (but i used quite "a trial & error method" & what i
told you is the *extract* of my experience).
>>I have noticed that every computer exploit and almost every linux program is builted in C
why is that? Because they just know to program in C or C is better for that kind of
programs and why?
C is older than C++ & was standardized almost a decade ago & hence it
has large community base. even Linus Torvald created Linux kernel many
years ago (IIRC in early 1990s & C++ was standardized in 1998, the year
C++ Primer 3/e was published)
Can somebody give an example of big project that
you can achive with C and you cant with C++ or vice versa?
do the 4 points.
Also can somebody suggest me a book for both of them !
Now, that will be a "recipe for disaster", if somebody does so.
(I dont want something
for begginers i want something to be as much complete book as it can
be, with all the topics you need to know for a programming language
.)Sorry for the number of the questions but i am a little bit
confused.
read & do those 4 points, only then ask for a book. Otherwise you will
waste a lot of money which you can earn later but you can not earn the
time you will loose.
take care

thanks

"arnuld'

Sep 29 '06 #9

P: n/a
Victor Bazarov wrote:
Big-Goofy wrote:
Thanks for your answers.
I already know programming in Java and I am starting studying the
perl. I would like to learn C or C++ but I need someone to tell me
the + and - of each one.

I hope you're not blind and should see the two pluses in C++... I
don't see any minuses there, do you? Neither does C have any minuses.
It just doesn't have any pluses, that's all.
Ha...Ha...Ha....
I have noticed that every computer exploit

Is that what you're trying to get into?
Hmmm... Victor is really serious here.
and almost every linux program is builted in C why is that? Because
they just know to program in C or C is better for that kind of
programs and why? Can somebody give an example of big project that
you can achive with C and you cant with C++ or vice versa?

Find Bjarne Stroustrup's home page and read all of it.

Best Answer Award, so far.

"arnuld"

Sep 29 '06 #10

P: n/a
va*****@hotmail.com wrote:
I already know programming in Java and I am starting studying the
perl. I would like to learn C or C++ but I need someone to tell me
the + and - of each one.
This might serve as a starting point:
http://www.digitalmars.com/d/comparison.html

Walter Bright
www.digitalmars.com C, C++, D programming language compilers
Sep 29 '06 #11

P: n/a
Big-Goofy (va*****@hotmail.com) writes:
I already know programming in Java and I am starting studying the
perl.
If you're free to choose, I'd suggest Python over Perl; it's much,
much easier.
I would like to learn C or C++ but I need someone to tell me
the + and - of each one. I have noticed that every computer exploit
and almost every linux program is builted in C why is that?
In part, your question is narrowing your view on what's naturally
written in C. I'm currently writing this article under gnus, which is
written in emacs-lisp; so is running under Linux as well?

In the sense of what's coming with a typical linux distribution, there
is a lot more than C software; C++, Java, Perl, Python, PHP, various
SQL-type stuff are only some of them.

I'm not aware of language comparison books, and every language
comparison I saw so far was biased and unfair.

Generally you probably want to have a problem or interesting project
first and then decide what language to use for it. C and C++ are
strong in correctness, performance and interfacing lower level
libraries. The higher level languages usually come with better
reusable code for specific problem areas, such as web development for
Python and PHP.
Can somebody give an example of big project that
you can achive with C and you cant with C++ or vice versa?
For C and C++, I'd sum it up as follows: C++ is safer and more
expressive, but also much more complex. For the type of stuff
you can do with them, they are, however, relatively similar - compared
to higher level languages.
Also can
somebody suggest me a book for both of them ! (I dont want something
for begginers i want something to be as much complete book as it can
be, with all the topics you need to know for a programming language
.)
For C++, Accelerated C++ is recommended by a lot of people, though I
don't know it myself. I learned with the C++ Programming Language by
Stroustrup. There is also Effective C++, More Effective C++ and
Effective STL by Scott Meyers which are a must-read (they are quite
thin). Of course, you shouldn't read all this before you begin coding.

On C, I can't really tell; however, there is _much_ less to say about
it than about C++, as far as the language is concerned. There is the
old classic The C Programming Language by K&R, which is what I have
used, and found to be okay.

I would focus on one of these language first, and rather not mix them
up at the beginning.

Best regards,

Jens
Sep 29 '06 #12

P: n/a
Phlip wrote:
.....
The only thing you can't do is the very last step of optimization. Kernels
like Linux's need that (and you _don't_), so they must use C-style code. C++
can compile C-style code, so they still don't need C.
There is no good reason not to use C++ to develop a kernel. There are
many great reasons to use it however.
Sep 29 '06 #13

P: n/a
In article <Cb******************************@giganews.com>,
va*****@hotmail.com <Big-Goofywrote:
>I already know programming in Java and I am starting studying the
perl. I would like to learn C or C++ but I need someone to tell me
the + and - of each one. I have noticed that every computer exploit
and almost every linux program is builted in C why is that? Because
they just know to program in C or C is better for that kind of
programs and why? Can somebody give an example of big project that
you can achive with C and you cant with C++ or vice versa? Also can
somebody suggest me a book for both of them ! (I dont want something
for begginers i want something to be as much complete book as it can
be, with all the topics you need to know for a programming language
.)Sorry for the number of the questions but i am a little bit
confused.
In your quest, you may want to consider these data points as well:

http://www.research.att.com/~bs/applications.html
http://www.research.att.com/~bs/new_learning.pdf
http://www.research.att.com/~bs/sibling_rivalry.pdf
http://www.ddj.com/showArticle.jhtml...leID=184401543
http://www.ddj.com/showArticle.jhtml...leID=184401555
http://www.ddj.com/showArticle.jhtml...leID=184401562

--
Greg Comeau / 20 years of Comeauity! Intel Mac Port now in alpha!
Comeau C/C++ ONLINE == http://www.comeaucomputing.com/tryitout
World Class Compilers: Breathtaking C++, Amazing C99, Fabulous C90.
Comeau C/C++ with Dinkumware's Libraries... Have you tried it?
Sep 29 '06 #14

P: n/a
In article <45**********************@news.newshosting.com>,
Ron Natalie <ro*@spamcop.netwrote:
>kwikius wrote:
>Phlip wrote:
<...>
>>Most C code can be tweaked to compile in C++. But Linux shouldn't compile as
C++ because Linux works on many kinds of CPU hardware, and some of them
don't have C++ compilers. Only situations without a C++ compiler strictly
need C.

re: Linux, AFAIK Linus Torvalds just plain doesnt like C++, and that
is the beginning and end of the matter. Theres an interview or quote
somewhere... but where I don't know.
Linux, fortunately, has gone way beyond the personal whims of Linus.
Just about every implementation of Linux I've seen uses the GCC suite
for it's compilers which pretty much comes with both C and C++. The
few exceptions also provide C++ environments.

There's no trememdously compelling reason to NOT allow C++ in the
kenrel. There are user-mode programs in LINUX that are written in
C++ (and a bunch of them like the X libraries would fare better had
they been written in a real object-oriented language rather than a
half-assed attempt to implement OO concept in strict C.
Indeed that's so, but C++ is not being used in LINUX and Linus
has a lot to do with it initially as I recall. I'm uncertain
why a spin-off has never occured, OTOH, it would probably need
a good reason over "just because we can".
--
Greg Comeau / 20 years of Comeauity! Intel Mac Port now in alpha!
Comeau C/C++ ONLINE == http://www.comeaucomputing.com/tryitout
World Class Compilers: Breathtaking C++, Amazing C99, Fabulous C90.
Comeau C/C++ with Dinkumware's Libraries... Have you tried it?
Sep 29 '06 #15

P: n/a
On 2006-09-29, loufoque <lo******@remove.gmail.comwrote:
kwikius wrote :
>re: Linux, AFAIK Linus Torvalds just plain doesnt like C++, and that
is the beginning and end of the matter. Theres an interview or quote
somewhere... but where I don't know.

Did you mean this quote ? (It's from 2004 I think)
You can obviously see he doesn't know C++ well and that moreover he does
nothing more than insult C++ and the people that use it.

[Beginning of quote]

The fact is, C++ compilers are not trustworthy. They were even worse in
1992, but some fundamental facts haven't changed:
<snip remainder of Linus spewage>

Yeah, raise your hand if you haven't read some overly-opinionated,
half-informed, inflammatory drek from Linus T. on 5 or more different
subjects.

That's ok, Linux is fun and I appreciate what he did/does. That
doesn't mean everything he says is gospel, and he probably knows that
he's sometimes an inflammatory blowhard. After all, who isn't a
blowhard at one time or another? Only when I do it, people don't quote
me.

--
scott
Sep 30 '06 #16

P: n/a
Greg Comeau wrote:
....
Indeed that's so, but C++ is not being used in LINUX and Linus
has a lot to do with it initially as I recall. I'm uncertain
why a spin-off has never occured, OTOH, it would probably need
a good reason over "just because we can".
My experience is that with well written C++ interfaces, it becomes much
easier to find bugs sooner. The kinds of bugs I see being patched in
Linux remind me of the issues I would run into in my C code which are
mostly cleared up with a good C++ interface.

I think the Linux maintainers have a much harder job maintaining C code
now than if they would be working on a good C++ base.

Some of the kernel maintainers probably agree that C++ would be a better
alternative to C but they're not willing to push the point.

There will come a day when a kernel spin-off will start using C++ and as
long as they can be backwards compatible with the C drivers (at a source
code level) there might be a chance to do it.
Sep 30 '06 #17

P: n/a
Gianni Mariani wrote:
Greg Comeau wrote:
My experience is that with well written C++ interfaces, it becomes much
easier to find bugs sooner. The kinds of bugs I see being patched in
Linux remind me of the issues I would run into in my C code which are
mostly cleared up with a good C++ interface.
i do think so & write now i am learning C++ from C++ Prime 4/e (an
illegal copy :-( i got as .chm file, 4/e edition is not available in
India, neither is "Accelerated C++")
There will come a day when a kernel spin-off will start using C++
and as
long as they can be backwards compatible with the C drivers (at a source
code level) there might be a chance to do it.
that is already happened. check: http://l4ka.org/projects/pistachio/

also see: http://www.gnu.org/software/hurd/hurd-paper.html

these 2 are my favourites but 2nd one is written in C.

Sep 30 '06 #18

P: n/a
In article <45***********************@per-qv1-newsreader-01.iinet.net.au>,
Gianni Mariani <gi*******@mariani.wswrote:
>Greg Comeau wrote:
...
>Indeed that's so, but C++ is not being used in LINUX and Linus
has a lot to do with it initially as I recall. I'm uncertain
why a spin-off has never occured, OTOH, it would probably need
a good reason over "just because we can".

My experience is that with well written C++ interfaces, it becomes much
easier to find bugs sooner. The kinds of bugs I see being patched in
Linux remind me of the issues I would run into in my C code which are
mostly cleared up with a good C++ interface.

I think the Linux maintainers have a much harder job maintaining C code
now than if they would be working on a good C++ base.
I have not followed it's history at a micro level, but it would
seems to me that over the years that they'd had to rewrite
whole parts even in C. I'm not saying that means to rewrite
those parts in C++, but just that as things progressed some
mistakes and etc must have been detected and resolved with
non-hack solutions. I can't imagine that wasn't the case for
parts, and can't imagine things like overall style and design
had nothing to do with it.
>Some of the kernel maintainers probably agree that C++ would be a better
alternative to C but they're not willing to push the point.

There will come a day when a kernel spin-off will start using C++ and as
long as they can be backwards compatible with the C drivers (at a source
code level) there might be a chance to do it.
Well, Comeau C/C++ now supports a ton of gccisms, and I've been
informed can be used to successfully compile LINUX, if that helps
anybody :)
--
Greg Comeau / 20 years of Comeauity! Intel Mac Port now in alpha!
Comeau C/C++ ONLINE == http://www.comeaucomputing.com/tryitout
World Class Compilers: Breathtaking C++, Amazing C99, Fabulous C90.
Comeau C/C++ with Dinkumware's Libraries... Have you tried it?
Sep 30 '06 #19

P: n/a
"Big-Goofy" <va*****@hotmail.comwrote in message
news:Cb******************************@giganews.com ...
: Thanks for your answers.
: I already know programming in Java and I am starting studying the
: perl. I would like to learn C or C++ but I need someone to tell me
: the + and - of each one. I have noticed that every computer exploit
: and almost every linux program is builted in C why is that? Because
: they just know to program in C or C is better for that kind of
: programs and why? Can somebody give an example of big project that
: you can achive with C and you cant with C++ or vice versa?

The main advantage of C compared to C++ is simplicity of the language.
C remains true to its roots as a "portable assembly language": little
to nothing happens behind the scene.
C++ has become a quite complex language. It supports a number of very
different programming styles (or "paradigmns"). Because there are many
more ways to implement a solution to a problem, confusion and somtimes
disagreements arise: it is easy, especially for a beginner, to find
new ways to shoot oneself in the foot, or to write inefficient or
unmaintainable code.

This is why, for large open source projects that have a large developer
base, C is sometimes an easier choice. Also, in some industries (e.g.
embedded systems), the fact that C is so well studied (coding style,
caveats, limitations) makes it feel like a less daring choice.

The reality is: C++ is a significantly more powerful language, and
has many features that allow writing more robust code. But it takes
years to master it completely (including its C subset).

: Also can
: somebody suggest me a book for both of them ! (I dont want something
: for begginers i want something to be as much complete book as it can
: be, with all the topics you need to know for a programming language
: .)

If you are looking for books, you can find inspiration in:
http://brian.accu.org/bookreviews/pu.../0sb/index.htm

Some picks to start with:
- Accelerated C++
- Thinking in C++ (free pdf version legally available online)
And then, well, all the highly recommended books found at
http://brian.accu.org/bookreviews/pu...vanced_c__.htm
It depends on which area of the language you want to master...

: Sorry for the number of the questions but i am a little bit
: confused.
Prepare for a long but rewarding journey...

Ivan
--
http://ivan.vecerina.com/contact/?subject=NG_POST <- email contact form
Brainbench MVP for C++ <http://www.brainbench.com

Sep 30 '06 #20

P: n/a
This might serve as a starting point:
http://www.digitalmars.com/d/comparison.html
IMHO, this comparison is biased. Almost half of the comparison criteria
are D language constructs. In a similar way an assembly language can
score much better if you put in criteria like "direct access to
register", "access to specific machine instructions", etc.

Ben
Oct 1 '06 #21

P: n/a
benben wrote:
>This might serve as a starting point:
http://www.digitalmars.com/d/comparison.html

IMHO, this comparison is biased.
Of course it is biased. It even says:

"And, like all language comparisons, it is biased in terms of what features
are mentioned, omitted, and my interpretation of those features."
Oct 1 '06 #22

P: n/a

Walter Bright wrote:
benben wrote:
This might serve as a starting point:
http://www.digitalmars.com/d/comparison.html
IMHO, this comparison is biased.

Of course it is biased. It even says:

"And, like all language comparisons, it is biased in terms of what features
are mentioned, omitted, and my interpretation of those features."
This looks ominous:

http://www.digitalmars.com/d/template.html

regards
Andy Little

Oct 1 '06 #23

P: n/a
kwikius wrote:
Walter Bright wrote:
>benben wrote:
>>>This might serve as a starting point:
http://www.digitalmars.com/d/comparison.html

IMHO, this comparison is biased.
Of course it is biased. It even says:

"And, like all language comparisons, it is biased in terms of what features
are mentioned, omitted, and my interpretation of those features."

This looks ominous:

http://www.digitalmars.com/d/template.html
That's a little dry, being a specification. For more on what the design
decisions are and how to use them:

http://www.digitalmars.com/d/templates-revisited.html
Oct 1 '06 #24

P: n/a

Walter Bright wrote:
kwikius wrote:
Walter Bright wrote:
benben wrote:
This might serve as a starting point:
http://www.digitalmars.com/d/comparison.html

IMHO, this comparison is biased.
Of course it is biased. It even says:

"And, like all language comparisons, it is biased in terms of what features
are mentioned, omitted, and my interpretation of those features."
This looks ominous:

http://www.digitalmars.com/d/template.html

That's a little dry, being a specification. For more on what the design
decisions are and how to use them:
OH I see. Try looking at it in IE6. Just looks like a blank page.

regards
Andy Little

Oct 1 '06 #25

P: n/a
kwikius wrote:
Walter Bright wrote:
>kwikius wrote:
>>http://www.digitalmars.com/d/template.html
That's a little dry, being a specification. For more on what the design
decisions are and how to use them:

OH I see. Try looking at it in IE6. Just looks like a blank page.
I am using IE6, and it displays fine.
Oct 1 '06 #26

P: n/a
Ivan Vecerina wrote:
This is why, for large open source projects that have a large developer
base, C is sometimes an easier choice.
That's something I hadn't thought of, but it makes sense. C++ is a very
difficult language to master, so the more C++ features you use, the
smaller the number of developers there are who can contribute
successfully to the project.
Oct 1 '06 #27

P: n/a
Walter Bright wrote:
>This is why, for large open source projects that have a large developer
base, C is sometimes an easier choice.

That's something I hadn't thought of, but it makes sense. C++ is a very
difficult language to master, so the more C++ features you use, the
smaller the number of developers there are who can contribute successfully
to the project.
That suggestion works both ways. C makes an endless range of trivial
operations (string copy, polymorphic collections, callbacks) absurdly hard.
So the more C++ techniques you use, the easier your code gets, and the more
crew you can use.

--
Phlip
http://www.greencheese.us/ZeekLand <-- NOT a blog!!!
Oct 1 '06 #28

P: n/a

Walter Bright wrote:
kwikius wrote:
Walter Bright wrote:
kwikius wrote:
http://www.digitalmars.com/d/template.html
That's a little dry, being a specification. For more on what the design
decisions are and how to use them:
OH I see. Try looking at it in IE6. Just looks like a blank page.

I am using IE6, and it displays fine.
What can I say. I see a blank page. with a quote about templates or so.
I need to scroll down a page to see any other data.

regards
Andy Little

Oct 1 '06 #29

P: n/a
kwikius wrote:
Walter Bright wrote:
>kwikius wrote:
>>Walter Bright wrote:
kwikius wrote:
http://www.digitalmars.com/d/template.html
That's a little dry, being a specification. For more on what the design
decisions are and how to use them:
OH I see. Try looking at it in IE6. Just looks like a blank page.
I am using IE6, and it displays fine.

What can I say. I see a blank page. with a quote about templates or so.
I need to scroll down a page to see any other data.
That's actually a bug in IE6. You'll see the same effect on Digg and
Slashdot.
Oct 1 '06 #30

P: n/a

Walter Bright wrote:
kwikius wrote:
Walter Bright wrote:
kwikius wrote:
Walter Bright wrote:
kwikius wrote:
http://www.digitalmars.com/d/template.html
That's a little dry, being a specification. For more on what the design
decisions are and how to use them:
OH I see. Try looking at it in IE6. Just looks like a blank page.
I am using IE6, and it displays fine.
What can I say. I see a blank page. with a quote about templates or so.
I need to scroll down a page to see any other data.

That's actually a bug in IE6. You'll see the same effect on Digg and
Slashdot.
Whatever. What I see is:

Templates
I think that I can safely say that nobody understands template
mechanics. -- Richard Deyman

I took it to be some sort of weird joke about D not actually
implementing templates, which may not be the impression you're after ?

regards
Andy Little

Oct 1 '06 #31

P: n/a
Phlip wrote:
Walter Bright wrote:
>>This is why, for large open source projects that have a large developer
base, C is sometimes an easier choice.
That's something I hadn't thought of, but it makes sense. C++ is a very
difficult language to master, so the more C++ features you use, the
smaller the number of developers there are who can contribute successfully
to the project.

That suggestion works both ways. C makes an endless range of trivial
operations (string copy, polymorphic collections, callbacks) absurdly hard.
Such are klunky, tedious and boring in C, sure, but not
hard-to-understand, as everyone who codes in C has to deal with it and
gets used to it.
So the more C++ techniques you use, the easier your code gets, and the more
crew you can use.
Certainly, C++ makes such things easier to use for people who understand
C++. I'm skeptical it makes things easier for people who don't
understand C++.

Let me give my favorite example: a friend of mine in college decided to
teach himself programming. He picked up the Fortran reference manual,
read it, and created his first program that wrote a bunch of data to a
file. It worked, but ran incredibly slowly. Mystified, he showed it to a
programmer who pointed out that the output file was opened, one
character was appended, and closed inside a loop, and why would he write
such obviously inefficient code? My friend replied that nothing in the
Fortran manual said anything about how I/O actually worked, so how was
he supposed to make the right design decisions?

I don't believe that people who don't understand C++ will be able to
write professional quality code in it, no matter how easy it looks.

In the end, it's just another consideration. For example, if I was
designing a device driver API for an operating system, I'd have it be a
C interface in order to maximize the pool of developers who can write
device drivers. Making it a C++ template metaprogramming API would
ensure that few would ever write a device driver.
Oct 1 '06 #32

P: n/a
In article <-d******************************@comcast.com>,
Walter Bright <wa****@digitalmars-nospamm.comwrote:
>Ivan Vecerina wrote:
>This is why, for large open source projects that have a large developer
base, C is sometimes an easier choice.

That's something I hadn't thought of, but it makes sense. C++ is a very
difficult language to master, so the more C++ features you use, the
smaller the number of developers there are who can contribute
successfully to the project.
I agree this is an issue of concern, but I have found that the
claim a few sentence down that "The reality is: ... it takes
years to master it completely (including its C subset)."
to be universally true of many languages, including C,
so it becomes an interesting thought. It also ignores the
consequences also statted that the reality also is that
"C++ is a significantly more powerful language, and has
many features that allow writing more robust code."
--
Greg Comeau / 20 years of Comeauity! Intel Mac Port now in alpha!
Comeau C/C++ ONLINE == http://www.comeaucomputing.com/tryitout
World Class Compilers: Breathtaking C++, Amazing C99, Fabulous C90.
Comeau C/C++ with Dinkumware's Libraries... Have you tried it?
Oct 1 '06 #33

P: n/a
In article <rE******************@newssvr25.news.prodigy.net >,
Phlip <ph******@yahoo.comwrote:
>Walter Bright wrote:
>>This is why, for large open source projects that have a large developer
base, C is sometimes an easier choice.

That's something I hadn't thought of, but it makes sense. C++ is a very
difficult language to master, so the more C++ features you use, the
smaller the number of developers there are who can contribute successfully
to the project.

That suggestion works both ways. C makes an endless range of trivial
operations (string copy, polymorphic collections, callbacks) absurdly hard.
So the more C++ techniques you use, the easier your code gets, and the more
crew you can use.
IOWs, the magic bullet remains elusive, and each way has its
own set of pros and cons, both short term and long term.
--
Greg Comeau / 20 years of Comeauity! Intel Mac Port now in alpha!
Comeau C/C++ ONLINE == http://www.comeaucomputing.com/tryitout
World Class Compilers: Breathtaking C++, Amazing C99, Fabulous C90.
Comeau C/C++ with Dinkumware's Libraries... Have you tried it?
Oct 1 '06 #34

P: n/a
kwikius wrote:
Whatever. What I see is:

Templates
I think that I can safely say that nobody understands template
mechanics. -- Richard Deyman

I took it to be some sort of weird joke about D not actually
implementing templates, which may not be the impression you're after ?
LOL. I'm poking a bit of fun of a famous Richard Feynman quote.
Oct 1 '06 #35

P: n/a
Greg Comeau wrote:
In article <-d******************************@comcast.com>,
Walter Bright <wa****@digitalmars-nospamm.comwrote:
>Ivan Vecerina wrote:
>>This is why, for large open source projects that have a large developer
base, C is sometimes an easier choice.
That's something I hadn't thought of, but it makes sense. C++ is a very
difficult language to master, so the more C++ features you use, the
smaller the number of developers there are who can contribute
successfully to the project.

I agree this is an issue of concern, but I have found that the
claim a few sentence down that "The reality is: ... it takes
years to master it completely (including its C subset)."
to be universally true of many languages, including C,
so it becomes an interesting thought.
It takes many more years to master C++ than C.
It also ignores the
consequences also statted that the reality also is that
"C++ is a significantly more powerful language, and has
many features that allow writing more robust code."
For someone who thoroughly understands those features, yes. For those
who don't realize when they need to provide a virtual destructor, no.
Oct 1 '06 #36

P: n/a
On Sun, 01 Oct 2006 12:12:59 -0700, Walter Bright
<wa****@digitalmars-nospamm.comwrote:
>Ivan Vecerina wrote:
>This is why, for large open source projects that have a large developer
base, C is sometimes an easier choice.

That's something I hadn't thought of, but it makes sense. C++ is a very
difficult language to master, so the more C++ features you use, the
smaller the number of developers there are who can contribute
successfully to the project.
Question: 'Every language has its flaws. What are the three things you
dislike most strongly in C++?'
Scott Meyers: 'I'd like to answer this question with "complexity,
complexity, complexity!"'
http://www.bookpool.com/ct/98031
Oct 1 '06 #37

P: n/a
Walter Bright wrote:
In the end, it's just another consideration. For example, if I was
designing a device driver API for an operating system, I'd have it be a C
interface in order to maximize the pool of developers who can write device
drivers. Making it a C++ template metaprogramming API would ensure that
few would ever write a device driver.
This is the difference between premature and postmature optimization.
Optimization generally obfuscates, yet an OS kernel that optimized by any
mean necessary would win the OS wars, and (at last) fully exploit our
hardware. That's a major benefit for the small cost of leaving behind the
driver authors who comprehend C-style optimizations better.

--
Phlip
http://www.greencheese.us/ZeekLand <-- NOT a blog!!!
Oct 1 '06 #38

P: n/a
Phlip wrote:
Walter Bright wrote:
>In the end, it's just another consideration. For example, if I was
designing a device driver API for an operating system, I'd have it be a C
interface in order to maximize the pool of developers who can write device
drivers. Making it a C++ template metaprogramming API would ensure that
few would ever write a device driver.

This is the difference between premature and postmature optimization.
Optimization generally obfuscates, yet an OS kernel that optimized by any
mean necessary would win the OS wars, and (at last) fully exploit our
hardware. That's a major benefit for the small cost of leaving behind the
driver authors who comprehend C-style optimizations better.
If one is trying to write a take-over-the-world operating system,
getting wide device driver support is huge. A lot of people who write
device drivers are hardware engineers (who designed the hardware
device), not software engineers. They aren't going to invest another 10
years just so they can write a device driver in C++. They just won't
support your operating system. An OS that won't run on the hardware I
need it to run on is useless to me, no matter how fast it is.

Perhaps you could, however, provide two driver APIs: one in C, and one
in C++.
Oct 1 '06 #39

P: n/a
In article <Es******************************@comcast.com>,
Walter Bright <wa****@digitalmars-nospamm.comwrote:
>Greg Comeau wrote:
>In article <-d******************************@comcast.com>,
Walter Bright <wa****@digitalmars-nospamm.comwrote:
>>Ivan Vecerina wrote:
This is why, for large open source projects that have a large developer
base, C is sometimes an easier choice.
That's something I hadn't thought of, but it makes sense. C++ is a very
difficult language to master, so the more C++ features you use, the
smaller the number of developers there are who can contribute
successfully to the project.

I agree this is an issue of concern, but I have found that the
claim a few sentence down that "The reality is: ... it takes
years to master it completely (including its C subset)."
to be universally true of many languages, including C,
so it becomes an interesting thought.

It takes many more years to master C++ than C.
My experience is that that is not always the case.
Probably neither of us can prove either way though.
>It also ignores the
consequences also statted that the reality also is that
"C++ is a significantly more powerful language, and has
many features that allow writing more robust code."

For someone who thoroughly understands those features, yes. For those
who don't realize when they need to provide a virtual destructor, no.
For those who don't realize, probably still won't realize
under other, probably more by-hand involved, alternatives.
--
Greg Comeau / 20 years of Comeauity! Intel Mac Port now in alpha!
Comeau C/C++ ONLINE == http://www.comeaucomputing.com/tryitout
World Class Compilers: Breathtaking C++, Amazing C99, Fabulous C90.
Comeau C/C++ with Dinkumware's Libraries... Have you tried it?
Oct 2 '06 #40

P: n/a
Greg Comeau wrote:
In article <Es******************************@comcast.com>,
Walter Bright <wa****@digitalmars-nospamm.comwrote:
>It takes many more years to master C++ than C.
My experience is that that is not always the case.
That's an extraordinary claim, especially since C++ is a superset of C.
How could it take less time?
Probably neither of us can prove either way though.
Providing proof and being convincing are two different things <g>.
>>It also ignores the
consequences also statted that the reality also is that
"C++ is a significantly more powerful language, and has
many features that allow writing more robust code."
For someone who thoroughly understands those features, yes. For those
who don't realize when they need to provide a virtual destructor, no.
For those who don't realize, probably still won't realize
under other, probably more by-hand involved, alternatives.
I've always figured out how languages worked by figuring out what needed
to happen under the hood. I admit to having a hard time seeing how one
can effectively use them without such knowledge.
Oct 2 '06 #41

P: n/a
Walter Bright wrote:
Greg Comeau wrote:
>In article <Es******************************@comcast.com>,
Walter Bright <wa****@digitalmars-nospamm.comwrote:
>>It takes many more years to master C++ than C.
My experience is that that is not always the case.

That's an extraordinary claim, especially since C++ is a superset of C.
How could it take less time?
One mechanism at work is idioms: for many things, C++ offers a different
approach. To master C++, you do not need to know what the best way of doing
X in the C subset is.
[snip]

Best

Kai-Uwe Bux
Oct 2 '06 #42

P: n/a
Kai-Uwe Bux wrote:
Walter Bright wrote:
>Greg Comeau wrote:
>>In article <Es******************************@comcast.com>,
Walter Bright <wa****@digitalmars-nospamm.comwrote:
It takes many more years to master C++ than C.
My experience is that that is not always the case.
That's an extraordinary claim, especially since C++ is a superset of C.
How could it take less time?

One mechanism at work is idioms: for many things, C++ offers a different
approach. To master C++, you do not need to know what the best way of doing
X in the C subset is.
You might be able to get a C++ program working, but you haven't mastered
C++ if you haven't mastered C. For one thing, writing C++ in the real
world also means working with C: C libraries, C system interfaces, etc.

Maybe we're talking different things, here. I know lots of people who
have mastered C - they rarely if ever need to consult the spec, they
know the entire language including corners and nasty surprises. How many
people know C++ that well? Heck, I wrote a C++ compiler and I still have
to go and check the spec, and I still get surprised. I get emails from
well known C++ experts sending me snippets of code wondering if they are
valid C++ code or not. I don't get those for C. Some people, like Scott
Meyers, have made a career out of helping people understand C++. Where
are the equivalent C gurus if C is as difficult?

It's reasonable to master C code in a year or two. Give it 5 years at
least for C++.
Oct 2 '06 #43

P: n/a
"Kai-Uwe Bux" <jk********@gmx.netwrote in message
news:ef**********@murdoch.acc.Virginia.EDU...
: Walter Bright wrote:
: Greg Comeau wrote:
: >Walter Bright wrote:

: >> It takes many more years to master C++ than C.

: >My experience is that that is not always the case.
: >
: That's an extraordinary claim, especially since C++ is a superset of
C.
[ NB: not quite a superset, but let's not go back to this ]
: How could it take less time?
:
: One mechanism at work is idioms: for many things, C++ offers
: a different approach. To master C++, you do not need to know
: what the best way of doing X in the C subset is.

Agreed.
Yet the list of things a proficient C++ developer needs to learn
to proficiently write C code is probably not too long.

Just out of personal curiosity, as a "native" C++ developer,
here's the list of things I find I need to do differently
when writing pure C code:
- "syntactic" differences (struct namespace, void*-to-T* conv.).
- learning "stdio.h" in-depth (formatted input & output especially),
and other library functions (e.g. the <math.h"overloads").
- malloc+memset, encapsulation using handles/hidden pointers,
and conventions for transfer of object/pointer ownership.
- error handling without scoped resource management:
return codes, benefits of SESE. (Hoping I won't need longjmp!)
- Features brought by C99: _Bool, runtime-sized arrays, init-lists,...
- preprocessor tricks to simulate templates etc ?

For my own education, I'd be interested in hearing what others
have to say about what a good C++ developer needs to learn when
switching to writing C code.

Any advice or recommendations from C gurus ?

Ivan
NB: I took the liberty to cross-post comp.lang.c. But this is not
about comparing the values of the languages -- no flames please !!

--
http://ivan.vecerina.com/contact/?subject=NG_POST <- email contact form

Oct 2 '06 #44

P: n/a

Ivan Vecerina wrote:
For my own education, I'd be interested in hearing what others
have to say about what a good C++ developer needs to learn when
switching to writing C code.
How to ride a unicycle :-)

And for C++ how to drive a Formula 1 car.

Vroom, Vroom :-)

regards
Andy Little

Oct 2 '06 #45

P: n/a
kwikius said:
>
Ivan Vecerina wrote:
>For my own education, I'd be interested in hearing what others
have to say about what a good C++ developer needs to learn when
switching to writing C code.

How to ride a unicycle :-)
Why? What possible advantage does it confer?

No, when switching to C, a good C++ developer needs to learn all about how
to re-use code. That is the heart of C.

And for C++ how to drive a Formula 1 car.
C++ programmers don't drive; they derive.

Whoever cross-posted this was asking for trouble, whether they realised it
or not.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)
Oct 2 '06 #46

P: n/a
Richard Heathfield wrote:
kwikius said:

Ivan Vecerina wrote:
For my own education, I'd be interested in hearing what others
have to say about what a good C++ developer needs to learn when
switching to writing C code.
How to ride a unicycle :-)

Why? What possible advantage does it confer?

No, when switching to C, a good C++ developer needs to learn all about how
to re-use code. That is the heart of C.

And for C++ how to drive a Formula 1 car.

C++ programmers don't drive; they derive.

Whoever cross-posted this was asking for trouble, whether they realised it
or not.
hmmm.... better add: lose your sense of humour, to the list of
attributes a C++ developer needs when switching to C I guess!

:-)

regards
Andy Little

Oct 2 '06 #47

P: n/a
kwikius said:
Richard Heathfield wrote:
>kwikius said:
>
Ivan Vecerina wrote:

For my own education, I'd be interested in hearing what others
have to say about what a good C++ developer needs to learn when
switching to writing C code.

How to ride a unicycle :-)

Why? What possible advantage does it confer?

No, when switching to C, a good C++ developer needs to learn all about
how to re-use code. That is the heart of C.

And for C++ how to drive a Formula 1 car.

C++ programmers don't drive; they derive.

Whoever cross-posted this was asking for trouble, whether they realised
it or not.

hmmm.... better add: lose your sense of humour, to the list of
attributes a C++ developer needs when switching to C I guess!
If you didn't find my reply amusing, you've already lost it. Read it again,
this time with your brain switched on.
--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)
Oct 2 '06 #48

P: n/a

Richard Heathfield wrote:
kwikius said:
Richard Heathfield wrote:
kwikius said:


Ivan Vecerina wrote:

For my own education, I'd be interested in hearing what others
have to say about what a good C++ developer needs to learn when
switching to writing C code.

How to ride a unicycle :-)

Why? What possible advantage does it confer?

No, when switching to C, a good C++ developer needs to learn all about
how to re-use code. That is the heart of C.
And for C++ how to drive a Formula 1 car.

C++ programmers don't drive; they derive.

Whoever cross-posted this was asking for trouble, whether they realised
it or not.
hmmm.... better add: lose your sense of humour, to the list of
attributes a C++ developer needs when switching to C I guess!

If you didn't find my reply amusing, you've already lost it. Read it again,
this time with your brain switched on.
The most amusing thought I had was of all the C programmers cycling to
work. :-)

regards
Andy Little

Oct 2 '06 #49

P: n/a

kwikius wrote:
Richard Heathfield wrote:
kwikius said:
Richard Heathfield wrote:
>kwikius said:
>>
>
Ivan Vecerina wrote:
>
>For my own education, I'd be interested in hearing what others
>have to say about what a good C++ developer needs to learn when
>switching to writing C code.
>
How to ride a unicycle :-)
>>
>Why? What possible advantage does it confer?
>>
>No, when switching to C, a good C++ developer needs to learn all about
>how to re-use code. That is the heart of C.
>>
>>
And for C++ how to drive a Formula 1 car.
>>
>C++ programmers don't drive; they derive.
>>
>Whoever cross-posted this was asking for trouble, whether they realised
>it or not.
>
hmmm.... better add: lose your sense of humour, to the list of
attributes a C++ developer needs when switching to C I guess!
If you didn't find my reply amusing, you've already lost it. Read it again,
this time with your brain switched on.

The most amusing thought I had was of all the C programmers cycling to
work. :-)
And you should appreciate that there is a great deal of skill involved
in riding a unicycle.

but I guess I'd better leave it at that .

Its always a mystery to me why some people prefer C over C++, but they
obviously do, and I have no problem with that. Live and let live I say.

regards
Andy Little

Oct 2 '06 #50

61 Replies

This discussion thread is closed

Replies have been disabled for this discussion.