old yes, out of date, no. It has its uses, for example a lot of "hardware gadgets" are programed in C, some server side or client applications can be done in C.. for games, yes out of date, but as a language overall no. But like I said, for anything you want to do, skip c.
intmain(){inta=1,b=2;asm{//This would switch the content of a and b.moveax,amovebx,bmovb,eaxmova,ebx};}
Assembler is a low level language, which is about as close as you can get to a computer's internal operations, I think. Unless you really want to flick 1s and 0s.
You have to do all fancy stuff like moving values into registers in order to be able to do stuff with them.
You can mix assembler code into your C+ + project to make you look more professional and to boost your ego.
Sometimes people (who are already professional and don't need an ego) actually use it when they really want to squeeze the last percent of performance out of their code.
Good programmers should have some understanding of Assembler (also CPU / RAM etc) in order to avoid some honeytraps. But for everyday's applications Assembler is not used directly.
call me a total dork but, I use I for all my loops...cept in C + + i always use C so i can do c + + in the loop -_- (im serious too....)
anyway im so mad I dont have my first command based C + + game ever on tis comp or id show you the code for that... if I can find it ill upload it, but theres nothing to to unique to c+ + styntax wise you dont see other places, other than
//Some of the cool stuff that is C-specific (at least in syntax) and that are used often://Automatic variable types://So you don't have to type it out yourself :Pautoi=5;//< this becomes an intautos="Booyah!";//< this becomes a const char*autostr=std::string("Booyah!");//this becomes a string//Initializer lists:Point::Point(intnewPosX,intnewPosY):m_x(newPosX),//m_x = newPosX;m_y(newPosY){//It's faster (in terms of performance) than setting them by hand.}//Loops//Molesterr you forgot the "int" in your loop, haven't you :Pfor(intc=0;c<10;++c){//Also, writing ++c is faster than c++. Pre-incrementing doesn't create a copy of the variable.DoSomeThingWithC(c);}//Since 'c' is declared inside the loop it'll be destroyed at this point//References//It's like an address of a variable. Used for copy-by-reference.voidfunction(int&a){a=5;//This changes 'a' even for the function that called it.}
All right, I know most programmers may never get their hands dirty on that stuff... Normally, having an assembly version of some critical loops can give you a performance increase up to about 30%, unless the compiler is being really stupid.
Then, there are other things for which assembly is invaluable. Let's say you wanted to write a NUMA-aware combining tree spinlock-based barrier thread synchronization for machines of 24-48 cores, there's only assembly that's up to the job. ( Don't get me started on standard threading libraries, not one has got that kind of stuff! )
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
Isn't 'C' old and out of date? :/
@StatusQ3: Go
is assembler not out of date?
old yes, out of date, no. It has its uses, for example a lot of "hardware gadgets" are programed in C, some server side or client applications can be done in C.. for games, yes out of date, but as a language overall no. But like I said, for anything you want to do, skip c.
for ANYTHING he could possibly want to do, yes.
The days where people write their stuff in Assembler are long gone.
You could as well be flicking 1s and 0s.
never heard of that. :P
@StatusQ3: Go
Assembler is a low level language, which is about as close as you can get to a computer's internal operations, I think. Unless you really want to flick 1s and 0s.
You have to do all fancy stuff like moving values into registers in order to be able to do stuff with them.
You can mix assembler code into your C+ + project to make you look more professional and to boost your ego.
Sometimes people (who are already professional and don't need an ego) actually use it when they really want to squeeze the last percent of performance out of their code.
Good programmers should have some understanding of Assembler (also CPU / RAM etc) in order to avoid some honeytraps. But for everyday's applications Assembler is not used directly.
just throwing this out there can some one tell me some commonly used c + + syntax?
call me a total dork but, I use I for all my loops...cept in C + + i always use C so i can do c + + in the loop -_- (im serious too....)
anyway im so mad I dont have my first command based C + + game ever on tis comp or id show you the code for that... if I can find it ill upload it, but theres nothing to to unique to c+ + styntax wise you dont see other places, other than
"using namespace std;"
anyone?
@aczchef: Go
if you talk about code conventions look for Hungarian notation
hmm but...
Hey, assembler is very useful too! :)
All right, I know most programmers may never get their hands dirty on that stuff... Normally, having an assembly version of some critical loops can give you a performance increase up to about 30%, unless the compiler is being really stupid.
Then, there are other things for which assembly is invaluable. Let's say you wanted to write a NUMA-aware combining tree spinlock-based barrier thread synchronization for machines of 24-48 cores, there's only assembly that's up to the job. ( Don't get me started on standard threading libraries, not one has got that kind of stuff! )