Jump to content
  • Advertisement
Sign in to follow this  
Mech_Master

C++ or ASSEMBLY?

This topic is 4869 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Advertisement
For what ?
A a lot of IO and networking maybe Java.
For a large reusable and fast app C++.
For a embedded system maybe ASM or C
and so forth ...

Share this post


Link to post
Share on other sites
Which is the problem you want to solve ??

Anyways, if you can you should stick with C++, use assembly only in cases where it is necessary (i.e. if you write a boot sector).

If speed matters, optimize your algorithm first and MEASURE the time.

Share this post


Link to post
Share on other sites
Oh so sorry.Im in the planing for a computer game and was wondering if we make a game in C++ or Assembly,wish one would give us more performance?Or we should use them both or C++ alone or Assembly alone?For the best performance.


Thanx alot

Share this post


Link to post
Share on other sites
No programming language will give you more performance just by preferring it over another one. Most of the game performance comes from good data structures and algorithms. Selecting a programming language is merely a matter of personal taste and experience. If you are good at assembly programming - go ahead and code your game in it. Otherwise you should use the language that you know best.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Pure assembly should give you higher performance if you know what your doing.

Most modern C++ compilers will optimise just as well as a assembly programmer in the majority of cases.

I wouldn't even bother with assembly programming unless it was something so low level that you absolutely had to use it (i.e. bootstrap code), or having to access video interrupts etc (even then I'd just have inline asm).

Share this post


Link to post
Share on other sites
Not assembly. Use C++.

Unless you are a very, very tallented assembly coder, you won't be faster than C++ And talented or not, development will take 10 times as long if you use assembly.

If you need to have a small section of code in assembly, you'll know this when you come to it, and you'll be able to insert the assembly into the C++ program.

And as was said - don't start with assembly. Write it all in C++ first, and then use assembly if you've profiled your application and you know you absolutly need it (and then profile again, so you know if your assembly is faster or slower).

Share this post


Link to post
Share on other sites
From your post I suppose that you don't know them, and want to know the differences to be able to choose what language to study. Well, I don't know assembly very well, but I really suggest you to study C++ for the following reasons (supposing that you are going to make common apps, no drivers-embedded-...):

Speed- ASM is potentially faster, because it let you to have control over every single instruction and memory usage. In addition, most compilers aren't able to take full advantage from the lastest CPU intructions (SSE/SSE2 and so on) because, IIRC some of them need a special setup of the code to be fully used (i.e. an instruction can be executed on many vars at the same time). But, and that is very important, compilers generate in most cases a code faster than what everyone but very experts can do, so the only way one can obtain ASM code faster than C++ one is to know ASM (and algorithms) very, very, very well.

Portability- C++ is, as a language, portable. ASM doesn't. That is, plain c++ code can be sucefully compiled on each system whit a standard compliant c++ compiler. Assembly instructions are different from a CPU to another and even from a OS to another there are differences in the programming rules (I mean interface with the OS and other, but I'm not an expert).

Easy to study- ASM is not difficult to study. Some people think that it is actually easer than C++.

Easy to use- Once you know the languages, I think that programming in C++ is a lot easer (and faster) than ASM, expecially for todays applications (like GUIs, net based applications, databases).

C/C++ is in my opinion a must for every programmer. There aren't, always IMHO, other languages as important as C/C++, aven if you will use other languages at work (or for yourself). So my suggestion is: learn C++ anyway, and then go into ASM, if you like.

edit: oh, I waited too much to anwer: others have already said that. So you're gonig to make games: well C++ is what you need (unless you want to spend months for even the simplest one). Quake was made in C (something in QuakeC and something in ASM), quake 2 in C++ (or C? don't remember), so Half Life 1/2 and, actually, most games. The only game made entirely in ASM I'm aware of is Roller Coster (don't know wich one) according to what said on another post in this forum.

Share this post


Link to post
Share on other sites
between C++ and assembly well both are important but i'd say c++. reason beign assembly is platform dependent and we know how new hardware is always beign churned at an alarming rate each with new features.

well if you go assembly, think you may have to work extra hard to be update(keeping in mind that assembly is not programmer friendly especially to a novice). c++ on the other hand will just provide you with api's to access the new feature without much effort but only understanding.

in the end, the choice is yours.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!