Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

C vs. C++

Name: Anonymous 2006-02-06 12:06

So, I've decided to go ahead and teach myself Game Programming. I picked up a book that seems pretty good for the task (Thompson's "Beginning Game Programming") that deals with the creation of 2D and 3D games using C and DirectX. Now, that's all well and good, but I've never specifically dealt with C before: only C++.

C++ I've learned in several college courses (I'm a Computer Science major), and have completed all the classes offered. These covered the range from Hello World to manually creating Binary Search trees (not using any built-in libraries to do the job for me). I'm fairly comfortable with the language, though nothing I've yet created in C++ used a GUI.

I'm aware that C is sort of a precursor to C++, with more limited capabilities, and much of the syntax is the same. My question for you all is how hard would it be to pick up C having only dealt with its more advanced relative? Is there anything I should know? Any good online resources I should check? (preferrably free)

Thanks for any help you can provide.

Name: Anonymous 2006-02-06 12:26

Picking up C will be easy if you know C++. Remember to tell your compiler to use C99, if it doesn't do that by default.

Name: Anonymous 2006-02-06 15:08

>>1
C is like C++ without the mess. Like >>2 said, use C99, and steal all the features from C++ your compiler supports, like operator overloading for structs, so you end up writing C++--.

Name: Anonymous 2006-02-06 15:55

>>3

I agree. Much of C++'s usefulness is derived from the STL and Boost libraries, so if you want to use C just write C++ in C style while enjoying all the useful bits that make C++ worthwhile.

Name: Anonymous 2006-02-06 16:12

OpenGL what.

Name: Anonymous 2006-02-07 12:37

C is like C++ without the stuff that makes it good. Wave goodbye to classes. :)

Name: Anonymous 2006-02-07 13:11

C is like C++ without the stuff that makes it suck. Wave goodbye to classes. :)

fixed

Name: Anonymous 2006-02-07 14:11

>>7

Classes are useful for serious programming, you dimwit.

Name: Anonymous 2006-02-07 15:59

They're just a type of interface.

If you want to do something useful with them, message-passing languages are a lot more useful.

Name: Anonymous 2006-02-07 16:45

>>9

Name: Anonymous 2006-02-07 18:26

>>7
Agree

>>8
Tell that to the guys who wrote 50%—60% of the software you're running *right now*, including the most complex components such as the OS. And there's not a single thing you can do in C++ you can't do in C++-- with a few lines of code at much, including polymorphism. Remember C++ was originally just a preprocessor for C.

Name: Anonymous 2006-02-07 19:24

>>11

I THINK YOU MISSED THE POINT SOMEWHAT

Name: Anonymous 2006-02-08 2:41

>>11
As much as I hate C++, I hate the argument "there's nothing you can do with foo you can't do with bar" even more. LET'S ALL PROGRAM IN ASSEMBLY LOL.

Name: Anonymous 2006-02-08 4:57

>>13
Oh, wai-
Perhaps I wasn't clear enough. Of course, there's nothing you can't do in assembly, but I mean there's nothing you can do in C++ you can't do in C in a way that's equally as simple/complex give or take a couple lines and/or supporting macros, and since C++ introduces a disgusting mess, I reasoned that it was a better idea to use plain C++-- and do the C++ things you really must elsehow.

Name: Anonymous 2006-02-08 6:32

>>14
Now there's something I can agree with.

Name: Anonymous 2006-02-08 11:13

I call lulz

Name: Anonymous 2006-02-08 14:25

If you want to do games then C++ is pretty much the only option because it's fast and is OO. Take a hint from the gaming industry. They all use C++.

Name: Anonymous 2006-02-08 17:33

They all use C++.

Except for the mobile bunch.

Name: Anonymous 2006-02-08 18:08

>>17
Yeah, take a hint from the business solutions industry. They all use Java; some even still maintain COBOL code. That doesn't make them any better.

Name: Anonymous 2006-02-09 7:25

>>19 game programming actually requires skill durrrr

Name: Anonymous 2006-02-09 8:10

>>20
Yes and no.

Yes, it has a pile of fancy tech, and long-timers in that industry really know their stuff. AI, graphics, UI, physics, audio, networking, and all performance too! Oh my...

But no, some parts (emphasis on some) of the business domain take the Right Stuff (TM). Unlike in gaming, if something goes wrong, you might be losing millions per minute. There's also that niggling problem of scalability.

Name: Anonymous 2006-02-09 8:59

>>21
Simple, stateless systems scale on $600 machines to whatever your network supports. But it's always better to develop a "professional enterprise business solution" with all "best practices", "Object-oriented", "XML-powered", "Java-powered", "Web 2.0", "industry standard" technologies that cost a gazillion dollars and take forever and a day to get to work - that's IF the project actually works before it's replaced by something else. How else do you think fat companies like Accenture or Sun make so much money?

Name: Anonymous 2006-02-09 9:02

>>22
I forgot to add, that has to run on a few servers, so they must have 64 processors each and cost 640 times what 64 simple PCs of comparable performance working in parallel would. Gotta keep the hardware market alive.

Just look at Google. Instead of all this "business solutions business solutions lol" bullshit, they develop their own shiz, use cheap ass PCs, lots of open sauce, and OMG no XML or Javur! And their webpages aren't XHTML1.1 compilant, oh noes!

Name: Anonymous 2006-02-09 9:13

>>23
Actually they do use Java internally.

Name: Anonymous 2006-02-09 9:48 (sage)

>>24
And the programmers hate it. Signs that Google is being taken over by clueless management bozos. People that actually think rm -rf actually wipes the data from the disk are becoming the norm there as well.

Name: Anonymous 2006-02-09 10:41

>>25
May I ask where you get this information?

Name: Anonymous 2006-02-09 11:12

>>26
Google developers blog

Name: Anonymous 2006-02-09 16:52

>>22
Don't take my comment out of context, you twit.

Do you think the people who build massive systems that run at Google (or banks, or stock-market, or whatever) are idiots? You've just supported what I said, except in that in your frenzy to say "Javur Is Evil" you missed that.

Nobody said Java isn't evil. It is. But just because someone works on business software doesn't make them stupid. You do realize that (Business iff Java/EJB/XML/etc) isn't true, right?

Name: Anonymous 2006-02-10 0:36

>>27
url?

Name: Anonymous 2006-02-11 12:42 (sage)

>>29
http://www.google.com/ you lazy fuck, I'm not your slave.

Name: Anonymous 2010-02-24 18:28

>>30
SUBMIT TO MY ANUS

Name: Anonymous 2010-02-24 20:43

>>18
No. MIDP programmers are the only ones that really use Java because they don't have a choice. Gaming never really took off in MIDP and the platform is dying quickly anyway. Most Android games use Java but thankfully since the NDK is out developers are switching to C++.

Almost all games for all other mobile platforms (iPhone, BREW, Symbian, Palm, WinMo, etc etc etc) are written in C++.

I worked at a mobile games studio and worked on games for all of the above platforms (well except Symbian, but Symbian C++ is the only language supported on that platform.)

Name: Anonymous 2010-02-24 20:51

>>1
All you need to know is this: everything they told you not to do in your C++ courses is actually the right way to do things in C.

The biggest difference you'll find is using POD structs instead of classes, and instead of methods you have plain old functions that take the struct as the first parameter. You have to implement most of the class stuff yourself, such as construction/destruction, vtables, etc. if you care to use such things.

C++:

class Foo {
  int x;

  void bar() {
    this->x = 5;
  }
}

int main() {
  Foo foo;
  foo.bar();
  return 0;
}


C:

typedef struct Foo {
  int x;
} Foo;

void FooBar(Foo* self) {
  self->x = 5;
}

int main() {
  Foo foo;
  FooBar(&foo);
  return 0;
}

Name: Anonymous 2010-02-24 20:52

GOD FUCKING DAMNIT NECROS

Name: Anonymous 2010-02-24 21:13

>>34
I guess that annoying thread necromancer is also the bastard responsible for the HMA crap.

Name: Anonymous 2010-02-24 22:08

ANNOY MY ANUS

Name: Anonymous 2010-02-24 22:19

>>31

FFFFFFFFUUUUUUUUUUUUUUUUUUU

Name: Anonymous 2010-12-25 23:05

Name: Anonymous 2011-06-10 18:10

look how much /prog/ has changed

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List