Archived

This topic is now archived and is closed to further replies.

vageta

I have a question about C and C++

Recommended Posts

I have started learning how to program in C with the intenet to eventually create games. I am undertanding it all quite well, and I intend to move to C++ once I am able to use C proficiently. I wanted to know if starting in C was a good idea, or should have I started in C++? And Is the transition from C to C++ difficult, or are a lot of the fundementals basiclly the same?

Share this post


Link to post
Share on other sites
Well, C++ is based on C, so starting in C is a good idea.
C++ is more OOP than C, so C++ is used for Windows.

The transition from C to C++ is, in general, NOT HARD, and if you understand C well, C++ should almost be a breeze.

Share this post


Link to post
Share on other sites
Well that''s a relif.
I was beginning to think that maybe starting in C wasn''t such a good idea.
I know that C is used for DOS and that C++ is used for Windows, so I though that since DOS isn''t really a major gaming platform any more it was a bad idea to start there.








Share this post


Link to post
Share on other sites
My move from c to c++ was basically this:

ren *.c *.cpp

In other words, you don''t have to un-learn anything, just learn some new concepts. After that, you become a bitch to the C++ language, and will never again - and I mean never - want to use straight C again. At least in my case.

Pythius

"You know you''re game''s in trouble when marketing throws a company party celebrating the release of beta, and it''s a complete suprise to the development team."

Share this post


Link to post
Share on other sites
quote:
Original post by vageta

Well that''s a relif.
I was beginning to think that maybe starting in C wasn''t such a good idea.
I know that C is used for DOS and that C++ is used for Windows, so I though that since DOS isn''t really a major gaming platform any more it was a bad idea to start there.




Choice of platform is usually independant of choice of programming language. You can write DOS programs in both C and C++. You can write Windows programs, including DirectX games (at least with DX7, don''t know about earlier) using both C and C++.

Only platform that I know of that really requires a particular language is BeOS, which requires C++ (unless you''re doing simple Unix-like command-line apps, in which case C works fine, IIRC).


---- --- -- -
Blue programmer needs food badly. Blue programmer is about to die!

Share this post


Link to post
Share on other sites
Actually, moss, no platform inherantly requires any specific language. All programming languages get translated to machine code anyway, so you can use whatever language you want on whatever platform you want as long as you have a compiler, interpreter, or assembler for the language you are using. As long as you have a program to convert the code in whatever language to assembly and machine code, you can use whatever language you want.

------------------------------
Jonathan Little
invader@hushmail.com
http://www.crosswinds.net/~uselessknowledge

Share this post


Link to post
Share on other sites
Win32 Was made with C in mind, so making application in Windows with C should no problem. COM application (eg. DirectX) is more OO, but it is no problem using COM with C.
I am programming Windows, both Win32 and DirectX, with assembly without any problems...just to point out that it really don''t matters which language you are using.

Share this post


Link to post
Share on other sites
quote:
Original post by Qoy
Actually, moss, no platform inherantly requires any specific language. All programming languages get translated to machine code anyway, so you can use whatever language you want on whatever platform you want as long as you have a compiler, interpreter, or assembler for the language you are using. As long as you have a program to convert the code in whatever language to assembly and machine code, you can use whatever language you want.



Yes, a very obvious answer. But I''d rather answer the question from the frame most people will use; that is, using standard programming tools, languages, environments, APIs etc. In that situation, most systems still do not place any requirements on choice of language, although BeOS does make it a little more difficult in certain respects.

I have nothing against the BeOS. I''m a registered developer, have a dual-66 BeBox, and have friends both within and without Be. It''s a decent system. But I don''t waste my time programming in machine instructions. So I use solely C++ on BeOS.



---- --- -- -
Blue programmer needs food badly. Blue programmer is about to die!

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
C and C++ can be used for making windows applications.

Also note, thats Charles Petzold''s book, one of the best out there for windows programming books is entirley in C (at least the one i have is).

I suggest you learn C, then if you want to, you can learn C++. But, since programmers need to know more than one language, starting in C and then learning C++ gives you claims to two languages, not just one.

Share this post


Link to post
Share on other sites
C++ is a super set of C (meaning it has everything that C has and more). I learned C first and i think this was probably the better way to go for me because you get to learn everything from under the hood before you implement it with C++ so you know what is going on. You can do all of the object oriented stuff in C before you move to C++ and then C++ basically makes it easier.
ex:
// In C a first class list adt
typedef struct _LIST_HEAD{
NODE * List;
}LIST_HEAD,*PLIST_HEAD;

PLIST_HEAD IntializeListHead();
void Insert(PLIST_HEAD Head,void * Object);
void * Delete(PLIST_HEAD Head,int Index);
void TerminateList(PLIST_HEAD Head);

//In C++
typedef class _LIST_HEAD{
_LIST_HEAD();//constructor which initializes the head
~_LIST_HEAD(); //destructor which terminates the head
void Insert(void *Object); //Method for inserting
void Delete(int Index); //Method for deleting
}LIST_HEAD,*PLIST_HEAD;

//C++ keeps it all in once nice package for you to use
C++ gives you a better structure to think object oriented
but it looks very familiar to C. Good luck in learning C++ and have fun.

--Fuel

I dream in Black and White.

Share this post


Link to post
Share on other sites