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

Doubts regarding C++ runtime

P: n/a
Hi,
I have been reading some text on C and C++ (i.e advanced books). One
of the books mentioned that C++ requires a runtime support whereas C
does not - what the author was trying to say was that once you compile
a C program the executable created is all that is needed whereas if you

compile a C++ program the executable created requires a C++ runtime
installed on your system to run the program.
Can someone please provide more information on this or could provide a
link to some webiste where this concept is explained in detail. I
would like to know the differences in C and C++ compiled code which
makes a runtime necessary for one and not for the other.

I had posted this on the comp.lang.c group but found that this topic
doesn't fit into that group, so trying my luck here.

Thanks
Ritesh

Jul 23 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
* Ritesh Kapoor:
I have been reading some text on C and C++ (i.e advanced books). One
of the books mentioned that C++ requires a runtime support whereas C
does not
A formally correct program requires runtime support in both languages.

For example, globals are (usually) initialized before 'main' is executed.

Usually that support is statically linked. Whether it is depends on the
implementation and what you direct it to do. Both languages also have
implementations where you can choose to not use the runtime support.

- what the author was trying to say was that once you compile
a C program the executable created is all that is needed whereas if you
compile a C++ program the executable created requires a C++ runtime
installed on your system to run the program.


No.

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Jul 23 '05 #2

P: n/a
Ritesh Kapoor wrote:

Hi,

I have been reading some text on C and C++ (i.e advanced books). One
of the books mentioned that C++ requires a runtime support whereas C
does not - what the author was trying to say was that once you compile
a C program the executable created is all that is needed whereas if you

compile a C++ program the executable created requires a C++ runtime
installed on your system to run the program.


Ahm, no.
The author is right, that C++ needs more runtime support (because eg. there
is much more going to happen during program startup). But he is not right
in saying that this runtime needs to be *installed* on a system. All
development systems I am aware of provide 2 options: Either you can ship
the runtime in the form of a 'shared library' or you can link the runtime
into the final executable. This is true for C *and* C++. So it is only
the programmer itself that makes the decission if he wants to ship 1
executable and get rid of the problem of having some to ship some libraries
in the correct version with his product or to ship just one single executable
and don't have that problem.
--
Karl Heinz Buchegger
kb******@gascad.at
Jul 23 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.