C or C++?

M

Martijn van Buul

* Bo Persson:
In theory yes, but in practice there are large parts of the C subset
that isn't very useful in C++. Why bother to learn about things like:

malloc and strcpy

Malloc is debateable, but not knowing about strcpy implies not knowing
about char * strings, which implies not knowing exactly why std::string
sucks so bad.

Oh, and not knowing about strcpy is not knowing why you should be using
strncpy to begin with.
why s1 == s2 is different from strcmp(s1, s2)

Because it implies not knowing the difference between pointers and
whatever they point to.
why you have library functions named abs, fabs, labs, cabs, etc - why
not just overload abs?

Because they don't do what you want.
what does printf("/!%%!%¤#") really mean (if anything)

More than <<'ing an iostream *EVER* give you.
how to use an address passed by value to simulate a pass by reference

That's nonsense, as this applies to C++ just as bad. If you never had
to pass an object by means of passing a pointer, you never did any programming
besides

std::cout << "hello world" << std::endl

References are *NOT* pointers, pointers are *NOT* bodged references.
how to use name prefixes to simulate namespaces

This is the *ONLY* one of your arguments that's not severely flawed or plain
wrong.
how to use variadic functions instead of overloads with different
number of parameters

Because they're not the same.
 
P

persenaama

In theory yes, but in practice there are large parts of the C subset
that isn't very useful in C++. Why bother to learn about things like:

Because these "things" are C++? It's up to anyone to choose how much
of any language they wish to learn and use. I don't use all of C++;
for example I don't use export and can get work done just fine, if not
better without it.

So you're saying it's better to know less? Or if you are saying:
"don't bother wasting time learning something you will likely have
very little use for" then I would agree 100% -- it's folly to learn
something obfuscated and obsolete, sure. But that is a far cry from
understanding the differences between C and C++ for the areas where
these two overlap.

With the processing power we got these days, it is more safe to say
that both C and C++ are less relevant than they used to. We don't
really need so fine grain control for most of the tasks we do as long
as the binary that actually does time critical sections of processing
is well crafted (in any language).
 
B

Bo Persson

persenaama wrote:
::: In theory yes, but in practice there are large parts of the C
::: subset that isn't very useful in C++. Why bother to learn about
::: things like:
::
:: Because these "things" are C++?

In theory yes, but in practice no. :)

They are hardly ever useful, so why start by learning those?

In C++ we have std::string, std::vector, and the standard library. We
don't need to START with learning about char*, malloc, strcmp, and
pointers. Or that you cannot overload functions in C (but that the
standard library can, using "magic macros").

::It's up to anyone to choose how
:: much of any language they wish to learn and use. I don't use all
:: of C++; for example I don't use export and can get work done just
:: fine, if not better without it.
::
:: So you're saying it's better to know less? Or if you are saying:
:: "don't bother wasting time learning something you will likely have
:: very little use for" then I would agree 100% -- it's folly to learn
:: something obfuscated and obsolete, sure. But that is a far cry from
:: understanding the differences between C and C++ for the areas where
:: these two overlap.

I was saying that it you want to learn C++, start learning C++.

The fact that C and Java might resemble C++, doesn't say that you
should start by learning one of those. Or that knowing the differences
between the languages is important if you just want to learn C++.


Bo Persson
 
P

persenaama

:: Because these "things" are C++?

In theory yes, but in practice no. :)

This is getting tiring. I call the Authority Card into play;
Stroustrup says himself the following, <quote>:

C++ is a direct descendant of C that retains almost all of C as a
subset. C++ provides stronger type checking than C and directly
supports a wider range of programming styles than C. C++ is "a better
C" in the sense that it supports the styles of programming done using
C with better type checking and more notational support (without loss
of efficiency). In the same sense, ANSI C is a better C than K&R C. In
addition, C++ supports data abstraction, object-oriented programming,
and generic programming (see The C++ Programming Language (3rd
Edition)"; Appendix B discussing compatibility issues is available for
downloading).

I have never seen a program that could be expressed better in C than
in C++ (and I don't think such a program could exist - every construct
in C has an obvious C++ equivalent). However, there still exist a few
environments where the support for C++ is so weak that there is an
advantage to using C instead.

For a discussion of the design of C++ including a discussion of its
relationship with C see The Design and Evolution of C++.

Please note that "C" in the paragraphs above refers to Classic C and
C89. C++ is not a descendant of C99; C++ and C99 are siblings. C99
introduces several novel opportunities for C/C++ incompatibilities.
Here is a description of the differences between C++98 and C99.

<end quote>
 
D

davideng2004

persenaama wrote:

::: In theory yes, but in practice there are large parts of the C
::: subset that isn't very useful in C++. Why bother to learn about
::: things like:
::
:: Because these "things" are C++?

In theory yes, but in practice no. :)

They are hardly ever useful, so why start by learning those?

In C++ we have std::string, std::vector, and the standard library. We
don't need to START with learning about char*, malloc, strcmp, and
pointers. Or that you cannot overload functions in C (but that the
standard library can, using "magic macros").

::It's up to anyone to choose how
:: much of any language they wish to learn and use. I don't use all
:: of C++; for example I don't use export and can get work done just
:: fine, if not better without it.
::
:: So you're saying it's better to know less? Or if you are saying:
:: "don't bother wasting time learning something you will likely have
:: very little use for" then I would agree 100% -- it's folly to learn
:: something obfuscated and obsolete, sure. But that is a far cry from
:: understanding the differences between C and C++ for the areas where
:: these two overlap.

I was saying that it you want to learn C++, start learning C++.

The fact that C and Java might resemble C++, doesn't say that you
should start by learning one of those. Or that knowing the differences
between the languages is important if you just want to learn C++.
Your ignorant view only shows how poor a C++ programmer you are. You
clearly don't know what select() is, what system calls are, or never
write any multithread applications.

Programming languages are evolved from assembly to C to C++. It is
true for an average C++ programmer like you, you only need to learn C+
+ to write mediocre high-level applications. But for large and high
performance applications, you have to use asynchronous I/O, signals,
and threads which require C knowledge. If you really want to know how
this works, you need know assembly. Let me put this way:

the average C++ programmers don't know C
the good C++ programmers know C
the best C++ programmer know assembly as well as C
 
A

arnuld

Programming languages are evolved from assembly to C to C++. It is
true for an average C++ programmer like you, you only need to learn C+
+ to write mediocre high-level applications. But for large and high
performance applications, you have to use asynchronous I/O, signals,
and threads which require C knowledge. If you really want to know how
this works, you need know assembly. Let me put this way:

RIGHT... but that is for becoming an excellent C++ programmer, not for
a person who is just doing a job in the field of C++ application
programming .


the average C++ programmers don't know C
the good C++ programmers know C
the best C++ programmer know assembly as well as C

GREAT... i am impressed. i never understood why there are no
discussion like "should i learn Assembly along with C++" because my
experience says, once you know assembly it is easier to tackle both C
and C++. all i see are "C or C++ arguments". personally i think
retaining C as subset in C++ was the poor idea. Stroustrup could have
created C++ as a new language for system programming with lessons
learnt from C but he did not :-(.

YES... i say people must learn Assembly if they truly aspire to
understand programming. IMVVHO, your 3rd point of "best C++
programmer" is quite right :)
 
M

Marcus Kwok

persenaama said:
This is getting tiring. I call the Authority Card into play;
Stroustrup says himself the following, <quote>:

C++ is a direct descendant of C that retains almost all of C as a
subset.

He also says:

Knowing C is a prerequisite for learning C++, right?

Wrong. The common subset of C and C++ is easier to learn than C.
There will be less type errors to catch manually (the C++ type system
is stricter and more expressive), fewer tricks to learn (C++ allows
you to express more things without circumlocution), and better
libraries available. The best initial subset of C++ to learn is not
"all of C".

http://www.research.att.com/~bs/bs_faq.html#prerequisite
 
P

persenaama

He also says:

It's already been established that C++ is subset of C.

What else he says is not relevant AS I AM NOT OPPOSING OR DEFENDING
ANY SPECIFIC interpretation of people's OPINIONS. My opinion is that
*I* am better with knowing more languages, more skilled, more demand
for my skills in the market out there. If someone is fine without C,
that's his experience and opinion, they are not necessarily same as
mine. Duh?

I for one would LOVE if people read what I write without jumping into
conclusions. Take care.

<3 <3 --persenaama
 
V

Victor Bazarov

persenaama said:
[..]
It's already been established that C++ is subset of C.
[..]
I for one would LOVE if people read what I write without jumping into
conclusions. Take care.

Conclusions? Like that you're either inattentive or dislexic when you
are angry? Why the hell would I read what you write if not to jump to
conclusions? Just to waste my time? Ppppleez...
 
C

Chris Hills

jacob navia said:
I agree that many members of that newsgroup have weird views, and I have
been atacked by those people a number of times...

But the problem is not those people. It is that those people have
reduced that group to a forum for themselves, and the users of
C that are open minded are completely discouraged to participate.

Very true.
 
P

persenaama

persenaama said:
[..]
It's already been established that C++ is subset of C.
[..]
I for one would LOVE if people read what I write without jumping into
conclusions. Take care.

Conclusions? Like that you're either inattentive or dislexic when you
are angry? Why the hell would I read what you write if not to jump to
conclusions? Just to waste my time? Ppppleez...

Wrong conclucions; looks like the guy was writing to some kind of pro
C fanatic, which ain't me. I'm saying C skill is relevant with C++ in
a lot of programming tasks beyond the scope of the C++ standard
document (think concrete applications and similar).

C++ is a subset of C. That's a fact; I don't see that being contested
just some random noise which changes nothing.
 
M

Marcus Kwok

persenaama said:
C++ is a subset of C. That's a fact; I don't see that being contested
just some random noise which changes nothing.

I think you have it backwards. I would say that C is (mostly) a subset
of C++. Maybe you meant to say that C++ is a *superset* of C?
 
P

persenaama

I think you have it backwards. I would say that C is (mostly) a subset
of C++. Maybe you meant to say that C++ is a *superset* of C?

Maybe I do. They call the parts of C++ that are similar to C89 "C
subset of C++", and Stroustrup was even more precise in his wording.
I'm under the opinion that backwards or forwards, the C subset of C++
is pretty important part of C++ to know.

I'm sorry if this opinion offends you so grealy that it requires four
follow ups so far. Just kidding, I'm not so sorry. :) :)
 
D

Default User

Chris said:
Very true.

Yeah, you two would think so. Jacob and Chris would like to "expand"
the C newsgroup to include platform-specific topics. There, as here,
that is considered undesirable.




Brian
 
G

gpuchtel

Stroustrup could have created C++ as a new language for
system programming with lessons learnt from C but he did not :-(.

Had he done that, it is very likely this group wouldn't exist today in
its present forum. Had Stroustrup not catered to the C community, C++
would never have been accepted by the C community (at that time),
something essential to the future success of C++. Stroustrup
acknowledges this in his book "The Design and Evolution of C++".

If you are going to criticize him for his decisions you should first
understand what influenced those decisions. Any serious C++ developer
should read this book. More importantly, anyone who decides to
criticize C++, Stroustrup or his decisions, and have some sense of
credibility doing it, should read this book first. Hindsight is always
20-20; all is not as it seems.
 
J

jacob navia

Default said:
Yeah, you two would think so. Jacob and Chris would like to "expand"
the C newsgroup to include platform-specific topics. There, as here,
that is considered undesirable.




Brian

This is not true. But there is no gain to discuss with you.
I have had my dose with the C group...
 
H

Herhor

Default User pisze:
Yeah, you two would think so. Jacob and Chris would like to "expand"
the C newsgroup to include platform-specific topics. There, as here,
that is considered undesirable.

It seems you are also undesirable on this newsgroup by many!

So in lieu of insulting this two guys here take a running jump to your
default C-ircus, fossil!
 
C

Chris Hills

Default User said:
Yeah, you two would think so. Jacob and Chris would like to "expand"
the C newsgroup to include platform-specific topics. There, as here,
that is considered undesirable.

I just have a slightly wider view of clc than a small group of net
nannies who spend more time screaming "OT" than any thing else. Though
they bend the rule of "standard C" to make it anything from K&R1 to
past the present standard. But not any standards they don't like
 
H

Herhor

Dnia 10-07-2007 o 09:33:23 Chris Hills said:
I just have a slightly wider view of clc than a small group of net
nannies who spend more time screaming "OT" than any thing else. Though
they bend the rule of "standard C" to make it anything from K&R1 to
past the present standard. But not any standards they don't like


Just ignore this SENSLESS madman!
 
D

Default User

Chris said:
I just have a slightly wider view of clc

A much wider view.
than a small group of net
nannies who spend more time screaming "OT" than any thing else.

This is a bald-faced lie, and you know it.
Though they bend the rule of "standard C" to make it anything from
K&R1 to past the present standard. But not any standards they don't
like

They only accept C standards. Just as this newsgroup deals with C++
ones. Why not try to get this one to "expand" the way you did in clc?
You'll get about the same reception, because the topicality rules are
pretty similar.




Brian
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,540
Members
45,025
Latest member
KetoRushACVFitness

Latest Threads

Top