C or C++ Please Help

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
kerdig
Posts: 1
Joined: Tue May 25, 2010 8:18 am

C or C++ Please Help

Post by kerdig »

HI
im leraning c right now so i just ask if i can program in c or i need to learn c++ to use engine?
freetimecoder
Posts: 226
Joined: Fri Aug 22, 2008 8:50 pm
Contact:

Post by freetimecoder »

Irrlicht is for C++
strale
Posts: 119
Joined: Wed Nov 23, 2005 1:58 pm
Location: Lambrugo Italy
Contact:

Post by strale »

In my point of view
if you know C
and you just want to play around the HelloWorld tutorial
you do not need to be a C++ wizard

just take a look about what a name space is
how to istantiate an object (C structure + functions )
how to call metod from the object obj.function() or obj->function()

bye
Midnight
Posts: 1772
Joined: Fri Jul 02, 2004 2:37 pm
Location: Wonderland

Post by Midnight »

strale wrote:In my point of view
if you know C
and you just want to play around the HelloWorld tutorial
you do not need to be a C++ wizard
I agree in that "play" mode it's pretty harmless and simple, however C++ isn't much more difficult to learn if you already know C. I personally started programing straight C++ using Irrlicht as my learning grounds.

I never ran into any major problems, no major hardware glitches, no segfaulting, and if there ever were memory leaks they never caused issues either. I did all of this without even knowing how a debugger worked, without knowing much at all, in that time I didn't know about any of that stuff.

Today I love C++ because it wasn't hard to learn the basics, I don't even come from a geeky background, I'm was a tinker nut as a kid, I would take toasters and vcr's apart when they were broken.

If I look back now I could have done it all in a couple months of work.

goodluck, happy coding!

I keep forgetting what I wanted to say.. C and C++ shouldn't be mixed heavily, you can get away with it inorder to play and learn, but it's bad programing practice. Irrlicht is written in C++ and to my understanding if you wanted to use C on top of that you need to register it all in the OS so it functions properly. I'm thinking extern commands and some other bit.

So ultimately the answer is: Go learn C++ if you expect to use this engine, C hasn't been used much in a long time on most things, it's time to evolve.
slavik262
Posts: 753
Joined: Sun Nov 22, 2009 9:25 pm
Location: Wisconsin, USA

Post by slavik262 »

I agree with most of what you said. C++ is mostly just a superset of C, so if you know C, C++ will be easy. My only contention:
Midnight wrote:I keep forgetting what I wanted to say.. C and C++ shouldn't be mixed heavily, you can get away with it inorder to play and learn, but it's bad programing practice. Irrlicht is written in C++ and to my understanding if you wanted to use C on top of that you need to register it all in the OS so it functions properly. I'm thinking extern commands and some other bit.
While this is generally true, there's circumstances where you'll want to mix C and C++. For example, when you build a dll, you can export your functions in C to avoid all the C++ name mangling. Or, say you need to integrate your C++ code with older system code in C (the Windows API does this all the time). It's not very hard to use extern commands at all... I'm not sure what you mean by registering it with the OS. I'd disagree that it's bad programming practice - doing it unnecessarily is dumb, but sometimes there's a need.
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

Seriously? There is absolutely no reason at all to avoid calling C code from C++ code. As a matter of fact, it is difficult to even write a C++ application that does anything useful without interfacing with a C library. Most modern operating systems expose their interfaces as C functions. On most platforms can't access files, sockets, graphics, databases, ... without accessing a C library at some level.

Travis
Post Reply