By using this site, you agree to our Privacy Policy and our Terms of Use. Close
NJ5 said:
radha said:
NJ5 said:

I said essentially a subset. There are g>very few things which work in C but not C++, and they're all small details which can be converted in one second. Those differences are not relevant for this thread, they're slight nitpicks as you can read here:

http://www.research.att.com/~bs/bs_faq.html#C-is-subset

Thus, C++ is as much a superset of ANSI C as ANSI C is a superset of K&R C and much as ISO C++ is a superset of C++ as it existed in 1985. Well written C tends to be legal C++ also.

You mentioned structures. C's structures are also supported in C++, in fact a class is just a souped-up structure which allows to use the public/private/protected keywords.

You mentioned speed. C++ is not slower than C with equal code, only if you use a slower C++ feature (which you aren't forced to).

 

Thats not all, C++ has a more strick type check and some types on C wont compile on C++. and when i say speed i mean at low level of course, since thats mostly the main use of C now days. 

 

More strict type checking, yes. But those things are very quick to solve and mostly occur on poorly-written code, which is why almost everyone says C is essentially a subset of C++. I hope we agree on that because it not only makes sense, but it's the generally held opinion (the quote I posted is from the guy who invented C++).

The fact stands that whoever knows C++, knows C.

I know what you meant by speed. But a good C++ compiler will compile well written C code to be as fast as generated by a C compiler. There's no reason for C++ to be necessarily slower than C other than a lower-quality compiler or using non-C features.

 

ok this is what i have been trying to say: from the compiler point of view it is a subset, because is compatible on a c++ compiler, but to someone learning is not true, he will get confused.  i dont think that someone that knows c++ knows c, different memory allocation, different use of strings, etc. I want to see some beginner that only knows C++ Compaling in a C compiler.

 



dd if = /dev/brain | tail -f | grep games | nc -lnvvp 80

Hey Listen!

https://archive.org/details/kohina_radio_music_collection