473,407 Members | 2,629 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

C or C++ something else....

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
61 2979
"kwikius" <an**@servocomm.freeserve.co.ukwrote in message
news:11*********************@i42g2000cwa.googlegro ups.com...
: 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.

You may once need to provide a stable and portable ABI, and realize
that, on most platforms, it is not possible to do so with a C++
interface.
Of course I would then still implement the library in C++, and provide
a thin C-style interface wrapper (with opaque handles etc).

You may want to contribute code to a project (such as the Linux
kernel) that does not leave you the option of using C++.

You may be developing code for a small embedded microcontroller
with 4k of RAM, for which only a C compiler is available.
I am not in any of these situations right now,
yet I thought this could be a legitimate question...

Ivan
--
http://ivan.vecerina.com/contact/?subject=NG_POST <- email contact form
Oct 2 '06 #51
Ivan Vecerina wrote:
"kwikius" <an**@servocomm.freeserve.co.ukwrote in message
news:11*********************@i42g2000cwa.googlegro ups.com...
>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.


You may want to contribute code to a project (such as the Linux
kernel) that does not leave you the option of using C++.

You may be developing code for a small embedded microcontroller
with 4k of RAM, for which only a C compiler is available.
That's not "prefer to", that's being "forced to" use C.

If I have to chose between C and C++, and there is only a C compiler
available, C is my first choice. Otherwise it is not.
Bo Persson
Oct 2 '06 #52

Ivan Vecerina wrote:
"kwikius" <an**@servocomm.freeserve.co.ukwrote in message
news:11*********************@i42g2000cwa.googlegro ups.com...
: 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.

You may once need to provide a stable and portable ABI, and realize
that, on most platforms, it is not possible to do so with a C++
interface.
Of course I would then still implement the library in C++, and provide
a thin C-style interface wrapper (with opaque handles etc).

You may want to contribute code to a project (such as the Linux
kernel) that does not leave you the option of using C++.

You may be developing code for a small embedded microcontroller
with 4k of RAM, for which only a C compiler is available.
But all these reasons are because you have no choice.

Actually the unicycle analogy is quite apt:

- You have to concentrate on all the details all the time.
- It's very esay to fall off.
- You take a long time to get anywhere.

regards
Andy Little

Oct 2 '06 #53
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.
I've heard estimates that it takes 6 months for a typical C
programmer to come up to speed on C++, and 12 months to be
any sort of expert.

However, some of the most basic features of C++ -- plain classes,
namespaces, overloading, basic STL features like vector and map, and
(perhaps) references -- can be learned in a matter of weeks and make
the language vastly more usable than C. Stroustrap's advice was
to not try to learn the whole language before starting to use
it productively. (And he said this back when the language was
smaller than it is now...)

Steve
Oct 3 '06 #54
In article <TY******************************@comcast.com>,
Walter Bright <wa****@digitalmars-nospamm.comwrote:
>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++.
Well, I could claim that about what you've said, but won't.

I know people who have claimed to learn C and other to learn
C++ "in a day". Of course, no such thing occurred.

Furthermore, IMO, nobody ever learns all of both languages.
Both you and I are in the C and C++ compiler business and
I bet both of us don't know all of C or C++. I will even
say that I bet you do not know all of D even though it is
your baby (for instance, I'll bet people send you code that
you either go Ugh to or Wow to because you never thought of
it before, etc). But I don't think that's what we're talking about.

I also personally believe that programming take a lifetime.
I certainly learn more about it each year. But I also think
that's different mastering than being discussed, although it
is in line for it.

Those things said:
In my experience it takes the average C beginner about 6 months
to *start* to be able to move with a swagger. And that it
takes about 9 months for C++. Also, as that is the average,
it might take some C programmers a year, and some C++ programmers
5 months, and so on. Also, it does not have to continue at
that same pace.

It also depends upon whether they are a complete newbie to
programming or not. For instance, somebody who already knows
Ada would not have some of the same concerns as somebody
who already knows COBOL, or against somebody who knows nothing
at all.

Intuition tells us what I've claimed makes no sense. But it's
not much different from some of the original claims about C++:
for instance, that because it was bigger than C, that it HAD
to be slower. That's not a generalism because the sum of the
parts is not always the same as the sum of the whole. I think
that we have a similar situation here.

Many claim that C++ is not a superset of C, and so many find
your claim that that is the case to be an extraordinary claim.
Personally if I had to choose I would say it is, but I also
acknowledge that there is some wiggle room here (actually more
than that, there is common ancestry but there is also different
approaches even on some of the so-called common parts).
And either way, the overlap becomes critital.
IOWs, a C++ programmer does not always learn "the C part of C++"
in isolation. Often it occurs in unison.

And no, that does not necessarily make them a C programmer too
in the end. Ironically though (again, intuition tells us otherwise,
often wrongly), many C++ programmers find that it makes them
better C programmers (not necessarily on the same issues).
Whatever it is about the culture and mindset I think is significant
here. For instance, I believe that many C++ programmers end
up understanding pointers better. I also believe that many
C++ educational approaches (for instance books) do a better job
at explaining concepts and techniques than their "equivalent"
C approaches which focus more on language. This also ripples
into other areas because although one can do many of the
techniques in C, there are not direct constructs through which
to do them with that are naturally supported by C. This lends
to a reverse learning kind of situation which the knowledge
becomes leaked in the C++ programmers case to the C++ side.

Also, despite C being around longer, and on more platforms,
it still has a limited and too low level standard library.
I find both C and C++s libraries daunting but at the same time
always expect that more can be added (which normally goes
against my default design constraints). This can pretty much
puts lots upside down when C++'s more high level library can
come into play.

On a personal level, I knew many languages before I knew C.
And I've always said I've had to learn C 3 times.
Against many other larger languages, I think I had the hardest
time with C. And I think some of the same issues fall out when
C++ is considered even though it is clearly larger and more
complicated. And certainly many of C++ problems are shared
not only by C but literally with C.

BTW, I also think there is biased picked up with people learn
programming languages. For instance many C programmer's style
might be influeced by K&R, and contrary issues might be influenced
by Stroustrup, and so on. I don't think that's just a neutral
issue or even just language cultural issue.

Re master C programmers, most of the master C programmers
I know do consult the spec. And I think saying they know all
corners, the entire language, and all nasty surpriseds would
be extraordinary. I think I know C well, but probably would
not make that claim about myself so maybe we are talking about
different things somehow. I agree many people know many of
the issues though, but probably not enough.

Despite being in the C++ compiler and other related businesses
I too find myself checking the C++ standard often, and as well
often being surprised. But despite being in the C compiler and
other related businesses, I also find that I need to check the
C standard too, and that often I'm surprised with it too.

So, in conclusion, it's reasonable to master both in about
the same time. There's too many issues on the table to say
otherwise anyway. I know in my own case that I knew an awful
lot about C in a year, and had written 100s of KLOC and large
apps in C and other languages at that point, but I think I would
be kidding myself to say I was a master C programmer at that point,
even though I probably thought I was.
--
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 3 '06 #55
In article <b3***************************@news.hispeed.ch>,
Ivan Vecerina <_I*******************@ivan.vecerina.comwrote:
>You may be developing code for a small embedded microcontroller
with 4k of RAM, for which only a C compiler is available.
Well, it ain't C99 and not C90 either, so usually,
that's actually some subset of C with extensions.
--
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 3 '06 #56
In article <4o************@individual.net>, Bo Persson <bo*@gmb.dkwrote:
>Ivan Vecerina wrote:
>"kwikius" <an**@servocomm.freeserve.co.ukwrote in message
news:11*********************@i42g2000cwa.googlegr oups.com...
>>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.

You may want to contribute code to a project (such as the Linux
kernel) that does not leave you the option of using C++.

You may be developing code for a small embedded microcontroller
with 4k of RAM, for which only a C compiler is available.

That's not "prefer to", that's being "forced to" use C.

If I have to chose between C and C++, and there is only a C compiler
available, C is my first choice. Otherwise it is not.
I think an underlying point being made was that C is available for
more platforms etc, but that's not the way it came out.
--
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 3 '06 #57
In article <ef**********@blue.rahul.net>,
Steve Pope <sp*****@speedymail.orgwrote:
>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.

I've heard estimates that it takes 6 months for a typical C
programmer to come up to speed on C++, and 12 months to be
any sort of expert.

However, some of the most basic features of C++ -- plain classes,
namespaces, overloading, basic STL features like vector and map, and
(perhaps) references -- can be learned in a matter of weeks and make
the language vastly more usable than C. Stroustrap's advice was
to not try to learn the whole language before starting to use
it productively. (And he said this back when the language was
smaller than it is now...)
The early estimates (see my post) could be reasonable,
but the master one need more time for both languages
and at that point it's a leapfrogging situation for both
languages anyway.
--
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 3 '06 #58
Greg Comeau wrote:
I know people who have claimed to learn C and other to learn
C++ "in a day". Of course, no such thing occurred.
#include <stdio.h>
int main ()
{
puts ("Hello");
}

#include <iostream>
int main ()
{
std::cout << "Hello\n";
}

I did it! And both at the same time!

I don't learned all features of the languages, but many people that uses it
habitually also don't know all. Then it's just a quantitative difference,
not qualitative ;-)

--
Salu2
Oct 3 '06 #59
In article <ef**********@panix2.panix.com>,
Greg Comeau <co****@comeaucomputing.comwrote:
>>>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.
BTW, this is not what my original remark necessarily pertained
to, but I think it's also worth pointing out that some people
can spend whole careers and not need to know every nook and
crazy of C or C++. For instance, embedded programmers were
mentioned in this thread.

There is far too often this sense that a programmer needs to
know everything, but in reality most programmers are going
to only be good at certain things.

For instance, designing, debugging, writing fast code,
writing maintainable code, fixing bugs, abstracting,
library writing, QA, systems programming, etc. Again, lots
of overlap but also lots of points that have nothing much
to do with each other at other levels. So you may have
somebody who can program circle around somebody else for
an embedded system, but switch to say a business app
with a user interface and they may be at a loss. And
there may or may not be language neutral issues at hand.

So master is not a sole term IMO. It's also not how much
of each standard can they recite, but also and perhaps more
importantly what can they do with it.
--
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 3 '06 #60
Julián Albo wrote:
[..] Then it's just a quantitative
difference, not qualitative ;-)
Actually, according to dialectics any quantitative difference
*is* qualitative.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Oct 3 '06 #61
=?ISO-8859-15?Q?Juli=E1n?= Albo posted:
#include <stdio.h>
int main ()
{
puts ("Hello");
}

Gratuitously off-topic, but that's bad C code. You should be explicit that
the argument list is empty by specifying "void", and you should have a return
statement in main.

#include <stdio.h>

int main(void)
{
puts("Hello");
return 0;
}

--

Frederick Gotham
Oct 3 '06 #62

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Martin Lucas-Smith | last post by:
I am trying to take a string and split it into a filename and a number where the number is what follows the *last* instance of a comma in that string. Split and explode won't work because if the...
2
by: ahevans | last post by:
HI, I have the following scenario if (isset($area)) { if ($area === 'green') { if (isset($task)) {
2
by: BigCalm | last post by:
I'm currently modifying a daemon (on AIX unix) which is primarily C source. At the moment, the daemon sleeps 30 seconds before checking if it has anything to do, but I'd like to improve this so...
5
by: SStory | last post by:
Hi all, I really needed to get the icons associated with each file that I want to show in a listview. I used the follow modified code sniplets found on the internet. I have left in...
4
by: Alan Silver | last post by:
Hello, Seems everyone's site nowadays has those "Ads by Goooooogle" boxes on them. I would like to do something similar, so I can provide an affiliate scheme. I don't want to supply HTML for...
13
compman9902
by: compman9902 | last post by:
Hello, and thank you for hwlping me with this run-in with trouble. I am making a script for pig latin transulation, and there is something wrong with the "if" statement in line 51. Here is the code...
4
by: lutzkac | last post by:
Hi Everyone, I am in a bit of a pickle and need some expert advice. I have a db in access. I am trying to create a query with fields from the tables. In my query I need to take the value of one...
10
by: Guillermo_Lopez | last post by:
Hello All, I am using VBA in access to perform some calculations. There is a particular sumation that is wrong (barely). this code is withing a loop. TDist = TDist + TempDist Both TDist...
0
by: Hendrik van Rooyen | last post by:
Lawrence D'Oliveiro wrote: The above is an endless loop, doing something every five seconds, and something else in the in between times. I don't think you are dense - its a good point,...
15
by: UberGirl | last post by:
Hi, I'm a novice... just trying figure out something simple, I'm sure. I've got a script within my <head> tags to show/hide divs on click: function showHide(divID, imgID){ if...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.