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

Pages: 1-4041-

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

Name: Anonymous 2011-06-10 20:58

>>33

Damn, thank you.

I'm starting to deploy what I learned in C# to C, and how to use typedef was always nebulous and with lots of crap making in unreadable for a beginner.

That's really sweet reading.

Name: Anonymous 2011-06-10 21:58

>>11
It astounds me that you used an em dash where a hyphen is the only appropriate punctuation, and yet when you could have very well used an em dash, you violated two hyphens and bastardized them into the task of a character that you are clearly aware exists and know how to type. Fuck you.

Name: Anonymous 2011-06-10 23:05

MORE LIKE
FUNCTION POINTER ARRAYS
WILL BE YOUR NEW PRISON GIRLFRIEND
AMIRITE LOLLLLLLLLLLLLLLLLLLLLLLLZzz!!11oNE!!1ONE1!

Name: Anonymous 2011-06-11 1:08

Nine years have already passed since an indescribable crime against humanity, the Bolshevik Revolution of 1917, was systematically begun. Now in its ninth year [1926], a government exists which calls itself a worker-and-peasant government—but not one true worker or farmer has ever sat on it. For nine years, torture has been used in the name of democra­cy as an official instrument of the state. And in the name of socialism millions of upright individu­als have been murdered, put to death through starvation, or banished from home and hearth to every distant part of the globe.
In the name of the proletariat the Russian people has been subjugated by rank foreigners, their speech has been silenced, and their bodies sent—to the cheers of the [Jewish] Third International — into mass graves.

Name: Anonymous 2011-06-11 1:46

Jews lined up other victims in military formation, then ordered the first row to place one hand upon a wooden table. A nail was driven through the hand into the wood. Then they cut a full circle around the wrist skin, drenched the hand in boiling water and  pulled the hand and finger skin right off. This  they called “making gloves”.

Interestingly, each torture chamber had its own special torture lady, always a Jewess or Latvian female, usually with a nickname such as “Dora, the glove maker” or “Rosa, the glove lady.”

Name: Anonymous 2011-06-11 1:58

>>45
source plz

Name: Anonymous 2011-06-11 1:59

>>46
http://en.wikipedia.org/wiki/Jacob_Schiff
During the Russo-Japanese War, in 1904 and 1905, in perhaps his most famous financial action, Schiff, again through Kuhn, Loeb & Co., extended a critical series of loans to the Empire of Japan, in the amount of $200 million. He was willing to extend this loan due, in part, to his belief that gold is not as important as national effort and desire, in helping win a war. It is quite likely Schiff also saw this loan as a means of avenging, on behalf of the Jewish people, the anti-Semitic actions of the Tsarist regime, specifically the then-recent pogroms in Kishinev.

Name: Anonymous 2011-06-11 2:02

>>47
This loan attracted worldwide attention, and had major consequences. Japan won the war, thanks in large part to the purchase of munitions made possible by Schiff's loan. Some within the Japanese leadership took this as evidence of the power of Jews all around the world, of their loyalty to one another, and as proof of the truth of the Protocols of the Elders of Zion.

Name: Anonymous 2011-06-11 4:33

  ∧_∧   ∧_∧   ∧_∧   ∧_∧      ∧_∧
 ( ・∀・)   ( `ー´)  ( ´∀`)  ( ゚ ∀゚ )    ( ^∀^)
 (    つ┳∪━━∪━∪━━∪━∪━∪━┳⊂     つ
 | | |  ┃This thread has peacefully ended.┃ | | |
 (__)_) ┻━━━━━━━━━━━━━━┻ (__)_)     Thank you.

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