
-----------------------------------
Mazer
Wed Sep 08, 2004 3:58 pm

From C++ to C
-----------------------------------
I'm starting computer science in University tomorrow, and for some reason we're going to be doing C. Stupid prof. He/she wrote the textbook that we're using, so it seems to me that there's a bit of an ego problem here. I've never actually used C before but some of the things I've heard is that there are no classes, and the structs only let you have member variables (no functions). What are the advantages of C? What else do I need to know?

-----------------------------------
Catalyst
Wed Sep 08, 2004 4:05 pm


-----------------------------------
well c++ is a superset of c, so you lose a bunch of nice features (such as classes, templates, new and delete, among others). But you supposedly gain  a small speed increase. The reason they probably start with c is to avoid diving into oop right away

-----------------------------------
Mazer
Wed Sep 08, 2004 4:18 pm


-----------------------------------
I figured as much. Which is just dumb. OOP is easier. So I no longer get to use new or delete... what is it now malloc() and free() or something? Bleh. At least it's not turing?

-----------------------------------
rizzix
Wed Sep 08, 2004 5:51 pm


-----------------------------------
yea well look at it this way.. it has been tested that c++ is much slower than C. thats why c++ is never used for creating realtime OS's or programs.. u know stuff used in robots/spacecrafts// etc... wherever performance is crucial. it is important u know C.. some stuff is a little different for the normal C++ way of doing things.

PS: after learning C, objective-c is a piece of cake.. u should take a look at it.

PSS: i dont really see a diff in performance in C++ and C.. but statistically there supposed to be  :?

-----------------------------------
wtd
Wed Sep 08, 2004 7:03 pm


-----------------------------------
C as a language is actually much better suited to teaching than C++.  C++ features a byzantine syntax with a lot of rules, and even more exceptions to those rules.  C is much simpler.

This doesn't mean that C is necessarily a better language, but it makes it easier to learn.

A quick translation:

// C++

#include 

int main()
{
   std::cout 