#92085 - gm112 - Tue Jul 11, 2006 2:36 pm
Alright I'm willing to begin homebrewing. I am wondering which language is the best between c or c++, also, I was wondering which tutorial was the best to startoff with.
EDIT: mod please move. I just noticed the DS forum. Sorry!
EDIT 2: How would I setup a batch file to compile my source code? (I already got the enviorment varibles setup)
Last edited by gm112 on Tue Jul 11, 2006 2:42 pm; edited 1 time in total
#92086 - gauauu - Tue Jul 11, 2006 2:40 pm
TONC is the best to start with (http://user.chem.tue.nl/jakvijn/tonc/index.htm)
As for C or C++, use whichever you are comfortable with. If you use C++, there's a few features you should be careful with that have the ability to slow your code down, but if used intelligently, either is fine.
edit: oops, this wasn't in the DS forum before, I assumed it was referring to GBA.
Last edited by gauauu on Wed Jul 12, 2006 7:05 pm; edited 1 time in total
#92118 - Buffi - Tue Jul 11, 2006 5:58 pm
Learn to walk before you learn to run.
It's better to learn C before you go into the new features of C++.
A good understanding of C will help you a whole lot when being introduced to objects.
#92228 - gm112 - Wed Jul 12, 2006 5:17 am
Ah, I'll go with C it looks more simple. Thanks for the help guys!
Off-topic:
@mod who moved this: Thank you
#92276 - silent_code - Wed Jul 12, 2006 1:41 pm
gm112 wrote: |
Ah, I'll go with C it looks more simple. |
i find c++ "more simple". ;)
good luck and happy coding!
#92278 - Buffi - Wed Jul 12, 2006 1:48 pm
silent_code wrote: |
gm112 wrote: | Ah, I'll go with C it looks more simple. |
i find c++ "more simple". ;)
good luck and happy coding! |
Why is that?
C++ is just C with a bunch of new stuff basically :)
I think it's better to learn the basics of programming before you jump into object orientated languages like C++.
#92280 - gm112 - Wed Jul 12, 2006 2:01 pm
I programmed with blitzmax. www.blitzmax.com. I know oop and encapsulation in that language. So, I have history in programming =]. I was planning on deving for the gba and nds for a year now =D.
#92285 - Sausage Boy - Wed Jul 12, 2006 3:17 pm
If you already know the theory behind OOP I would absolutely recommend C++. Since C++ is really just fancy C with OOP, there's no reason to learn C first.
_________________
"no offense, but this is the gayest game ever"
#92318 - sajiimori - Wed Jul 12, 2006 7:41 pm
C++ is not "C with OOP". It's one of the most complex programming languages in the world. If you like jumping straight into that sort of thing, go for it.
#92464 - silent_code - Thu Jul 13, 2006 4:40 pm
right, c++ isn't "just an upgraded c". indeed, oop should be understood when using classes and its concepts, but it is no harder than any other language. every language has its pros and cons. c++ is very low level (for a high language, that is) and gives you total control over the hw and os features.
that means that an unexperienced programmer won't be able to produce optimized code instantly ;p ... there is next to no string support in the language, too. but it is very flexible and extensible. it has its standard libraries and optimized libraries like boost (that is a playground for new features to be eventually implemented in later revisions of the standard libs ;D ).
i also see it as a feature that the language has a very small set of keywords (63) because you don't mess around with too many of these, yet you can do whatever you want with it (well, not EVERYTHING you want ;D - like let it rub your back... ;P). add a consistent set of rules with a clear syntax and you have a very powerful tool to implement your designs and systems.
imo, why learn one language to start with another right after that? i don't see the point. c programs are quite different in design than c++ progs. that's clear to someone who knows both, but a newcomer won't see big differences (plus you may mix c with c++ in most cases). why confusing that person with a simmilar (but different) language in the first place? e.g., i found malloc and free are harder to use than new and delete. there are quite some of those examples. i also think that c++ progs are potentially easier to maintain. think about templates... doing something similar in c is a pain. all those (void*)s... inheritence? nope for c.
you have to admit, that once you understand it, you won't give c++ away. ;)
my advise: learn c++ basics first, then learn to use it (start some >simple< useful projects) and finally learn how to make your code efficient (e.g. through more advanced data structures and the like).
there's a lot of info about each of these steps on the net and there are some really great books out there, too! check your local book store or some online shop.
if you like to leanr c++ anyway, start with it and don't waste your time with c.
PS: THESE ADVISES ARE BASED MY OPINION AND EXPERIENCE WITH THE TWO LANGUAGES. I KNOW EVERYONE HAS HIS/HER FAVORITE, I'M JUST TRYING TO HELP. PLEASE KEEP THAT IN MIND.
[ and please, don't start a c/c++ war ;D ]
#92475 - gm112 - Thu Jul 13, 2006 5:24 pm
silent_code wow......that just made me change my mind. Nice post XD. I also noticed C and C++ is a highly documented language compared to others.(C++ 6.0 as of now)
#92481 - nukomod - Thu Jul 13, 2006 5:28 pm
The way I see it C and C++ are used side by side constantly, I'm not sure if I've seen a purely C++ or purely C source code for a long time. C++ has some features which can reduce performance, but also has some features that when used propely can slice development time, make refactoring a breeze and create more robust code.
I would say however just use a blend of both, if you see a case where a OOP approach would work then great, but if it doesn't need it then just use some functions and structs. I don't like getting too bogged down worrying if my code is OOP enough or all C, just a happy medium. I like to have a few globals but I keep a close eye on their dependencies, which you'll find is the real kick in the teeth with C++... include hell!
Ok that's sort of a rant, enjoy ;)
#92490 - silent_code - Thu Jul 13, 2006 5:43 pm
gm112 wrote: |
silent_code wow......that just made me change my mind. Nice post XD. I also noticed C and C++ is a highly documented language compared to others.(C++ 6.0 as of now) |
:)
#92530 - sajiimori - Thu Jul 13, 2006 7:55 pm
If you don't care to understand what's happening under the hood, or why C++ is designed the way it is, listen to silent_code.
I've known a lot of mediocre programmers and a few good ones. The difference is largely in how well they understand their tools, inside and out.
At any rate, if you pretend that there is no complexity under the surface, you are entering a world of pain. ;) That complexity will bubble up and shatter your illusion of simplicity when you least expect it, especially in C++. Anyone who doesn't acknowledge that... well, I have to wonder how well they know C++.
Edit: Perhaps the thing to take away from this is that the issue is contraversial. :P My opinion is that teaching C++ to beginners is absurd. A lot of cheap certification programs disagree, of course, but look at what they churn out...
#92629 - Buffi - Fri Jul 14, 2006 7:21 am
nukomod wrote: |
I'm not sure if I've seen a purely C++ or purely C source code for a long time |
Uh... what does this even mean?
Purely C++ sounds weird since C++ is based on C and has a syntax that in many cases are exactly the same.
And also... I see programs written in pure C all the time :)
#92642 - nukomod - Fri Jul 14, 2006 9:16 am
By purely C++ I mean fully OOP with and using all the new C++ headers and standard library, but that's just my interpretation. I've not seen any all C code source for a good while, but meh that's just coincidence no doubt.
#92701 - Sausage Boy - Fri Jul 14, 2006 4:14 pm
From the creator of C++'s FAQ:
"C++ is a direct descendant of C that retains almost all of C as a subset."
"C++ supports every programming technique supported by C. Every C program can be written in essentially the same way in C++ with the same run-time and space efficiency."
Read the whole thing (it's long, but it's worth it) at
http://www.research.att.com/~bs/bs_faq.html
sajimori, has the thought ever struck you, that the good programmers you've known perhaps have been mediocre at some point? And how did they learn C++ inside out? Certainly not by studying C! The only way of learning a language inside out is to use it, use it and use it. Sure, you'll hit the wall from time to time, bang your head into the table and scream out in misery, but after you've solved it, you will be a better programmer.
My question remains, why learn C?
_________________
"no offense, but this is the gayest game ever"
#92711 - silent_code - Fri Jul 14, 2006 4:44 pm
sajiimori wrote: |
If you don't care to understand what's happening under the hood, or why C++ is designed the way it is, listen to silent_code.
I've known a lot of mediocre programmers and a few good ones. The difference is largely in how well they understand their tools, inside and out.
At any rate, if you pretend that there is no complexity under the surface, you are entering a world of pain. ;) That complexity will bubble up and shatter your illusion of simplicity when you least expect it, especially in C++. Anyone who doesn't acknowledge that... well, I have to wonder how well they know C++.
Edit: Perhaps the thing to take away from this is that the issue is contraversial. :P My opinion is that teaching C++ to beginners is absurd. A lot of cheap certification programs disagree, of course, but look at what they churn out... |
i don't want to flame you, just comment! :)
what meant in my "big" post is that i don't think it is necessary to learn (the restrictions of) c (though i like that language a lot!) to fully understand the concepts and design decisions of c++.
it's true, c++ is the child of c and oop, but would you date a girls mother before dating the girl, just to know what she inherited from her mother? i don't think so. ;)
didn't i mention the complexity of c++? shame on me.
well, sure it is complex. but most concepts are straight forward. of cause one should understand what a language does and why it does it that way. you're totally right. but that fits about every language. you don't know your tool, you can't use it. simple as hell. :)
there's nothing special about the world of c++ pain. hurts like any other language. relly. i tried a few ;) but c++ is a faw more superior tool than any other language i know. so mastering it will give you more benefits.
there are people who are obsessed by the idea that c++ generates bloated binaries and isn't as fast as c or asm. then think about why it is THE language of choise? it all depends on how good you use the features the language offers you. you don't need to know c to be a good c++ programmer, you need to know c++ to be a good c++ programmer. knowing how it works, you may be able to write programs in c++ that are as fast as asm progs (may also depend on the compiler). you just have to know your language. [by any means do i not say that i am one of those c++ masters.] anyway, it would make more sense to learn asm than c before learning c++, imo. that's something noone says, i wonder why?
e.g. a beginner may write a c prog that assembles to like five instructions. the same programmer (beginner) could write a simmila prog in c++. that one would maybe assemble to eight lines. well. doesn't sound good, does it? it's like 1:0 for c... maybe not. because this is just a simple numbers example we can say that an experienced (not too advanced) programmer changes bits of the c++ sources. after that the c++ prog could assemble to like four instructions.
i've seen enough of such (real world) examples. again, it really depends on how you use your tool. and this example isn't just a one way thing. a beginner may also write a c++ prog that is faster (uses optimized instructions or simply has fewer instructions) than his similar c prog.
another thing is that you have to learn to use c++ properly. as i said there are lots of good books (and also a bunch of crap) on the topic. there are some good authors that have written several books and some of them have even worked on the c++ standard. they know the guts of c++.
again, if you want to learn c++, because you are interested in oop, then don't think twice and skip c. you'll learn most of it anyway, but from the view of a c++ programmer. having oop concepts available from the start may also help you write good oop code later on. ;) [i admit i often use c for file i/o and stuff, though i know the c++ way... it's a habit from the old c days ;) even though i find using c++ for those operations easier... that's wierd. i'll work on it ;p]
and if you start out >small<, you may even start learning c++ without ever having programmed in your life. depends on who teaches you. ;)
all in all, i advise (again) to learn c++ if you want oop. if you don't, c is a very good thing.
happy coding!
ps: i really don't want to write another comment like this... there are some good programmers out there that know a lot about the subject. looking at my posts they may seem pretty basic and too simple, but remember this guy wants some constructive advise.
make war, not ... oh, it was the other way around ;p
#92763 - sajiimori - Fri Jul 14, 2006 9:15 pm
If anyone is curious about what I mean when I say "a world of pain," check out the "Effective C++" books and just about anything by Herb Sutter.
Yeah, I've used a lot of languages too. I've never used one with more ways to screw yourself in quantity, frequency, obscurity, and severity. Ever forget to declare a base destructor virtual? Ever delete a pointer to a forward-declared type?
(Are you aware of what happens in the latter case?)
C++ is not "the" language of choice -- don't overstate. It's very popular, but decreasingly so.
Learning C++ starting with its simplest features amounts to learning C first.
And with that, I'm tired of this thread.
#92909 - wintermute - Sat Jul 15, 2006 2:40 pm
C++ isn't THE language of choice. A good workman chooses the right tools for the job.
Sometimes C is sufficient for the job although using a C++ compiler to write C code can give you better error checking.
The learn to program section of How to become a hacker makes some very good points.
_________________
devkitPro - professional toolchains at amateur prices
devkitPro IRC support
Personal Blog
#93089 - masscat - Sun Jul 16, 2006 10:22 pm
Always sit down and think about what you are trying to do and then plan how you are going to do it.
Implementation (the sitting down and writing the code) should be the easy bit. If it is not then you are going to get into "a world of pain" no matter what language you choose.
Always sit down - it is the most important part.
#93153 - Buffi - Mon Jul 17, 2006 7:05 am
masscat wrote: |
If it is not then you are going to get into "a world of pain" no matter what language you choose. |
However the low level memory management in C and C++ makes it a lot easier to get into big problems like memory leaks and similar stuff, than in higher level languages...
There are like... a lot of stuff in C++ that is hell to debug if you do them wrong :)
#93168 - silent_code - Mon Jul 17, 2006 9:39 am
... but low level management makes it a potentially high performance language... and i don't get your point. we're talking about a recommendation of either C or C++! so what's the value of your post in regards to the topic? i really don't want to offend you, just let you reflect what you've said.
guys, we're talking about what language (c/c++) to recommend to a starting garage game developer... and that's it. we're not talking about robotics, ai, not even about game tools programming - just game programming. some of you seem to forget that. the question is not which language is the best, but the best to use in game development.
whatever language you learn, make sure you learn it properly ("if you do it wrong").
having said what i wanted to say, i'm out.
happy coding.
ps: that's why it has allways been a "world of pain" to post such a question on a forum. though i'm not blaming anyone for anything. lesson learned. i won't recommend any language on forums anymore. just imagine it was possible to program the nds in other languages: "weeee, but pure pascal is sooo much better than object pascal and c and c++ and c# and java for nds!" THAT would be a real pain ;D
#94041 - brian33x51 - Sat Jul 22, 2006 6:00 pm
If you code in 'C' I very strongly suggest you compile it as C++. The compiler is more strict and will catch more errors, which is IMHO a good thing.
A bad thing about 'C' is that it allows some coders to "jack around" too freely.
I'm a C++ coder but I can easily envision something like 'D' taking over the world. I'm an open source guy and I share in the common belief that languages like java, c#, .net, etc cause more harm than good (and suck up more resources too, btw).
People bitch about how c++ is non garbage collected. I'd say that c++ exposes bad software design more more quickly than the other languages do. That sort of implies that more skill is needed to code in c++. Of course that also isn't a great thing since coding is about solving problems and not about the tools themselves.
Last edited by brian33x51 on Sat Jul 22, 2006 6:06 pm; edited 1 time in total
#94043 - tepples - Sat Jul 22, 2006 6:03 pm
brian33x51 wrote: |
If you code in 'C' I very strongly suggest you compile it as C++. The compiler is more strict and will catch more errors, which is IMHO a good thing. |
gcc -Wall will catch most of those errors as well. I recommend against compiling C as C++ in a release build because, for example, it makes AXE balloon from 7 KB to roughly 100 KB.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#94048 - sajiimori - Sat Jul 22, 2006 6:24 pm
What's AXE?
Also, did you disable exceptions?
Last edited by sajiimori on Sat Jul 22, 2006 6:26 pm; edited 1 time in total
#94049 - tepples - Sat Jul 22, 2006 6:26 pm
See DS gets the AXE
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.