# How C Code Looks in Assembler



## ivanjs (Oct 11, 2005)

Here's an article I wrote comparing very simple C code to its equivalent PowerPC assembler. Shows loops, switch statement, pointers, variable storage, etc. Each line of assembler code is explained for comparison.


----------



## boyfarrell (Oct 11, 2005)

It's pretty quiet on this board at the moment...

I saw this dug on digg.com a few week back. It's really interesting. Makes you wonder if knowing a bit of assembler might make you be able to tweek for really high performance ... then again it will probably turn into a horrible mess!

What does an Objective-C Object look like? The same as a struct ?

How did you get to view the assembler code?

Dan


----------



## kainjow (Oct 11, 2005)

My professor wrote tons of books on x86 assembly, and so he showed us the x86 asm equivalent of some C structures. He basically pointed out that a certain loop (I forget whether it was for or do-while) was the most efficient.

Most of this stuff doesn't matter for desktop and laptops, but it does when you're working with embedded systems, where milliseconds can make a big difference.

I find it interesting, since most programmers don't know assembly (and PowerPC assembly will be less useful as Macs move to x86).


----------



## Squart (Oct 11, 2005)

It's a really cool article, I've started reading it but it will take a bit until I've read throug it. Thank you.

@boyfarrell: If you have a projekt you can easily look at the assembler-code by clicking in the menu at Build->Show Assembley Code.


----------



## boyfarrell (Oct 12, 2005)

That easy! Cheers.


----------



## Viro (Oct 12, 2005)

I liked the article. Give us more!


----------



## kainjow (Oct 12, 2005)

Squart said:
			
		

> ...projekt...


project


----------



## Squart (Oct 12, 2005)

kainjow said:
			
		

> project


Thank you 

Yeah, that is the risk you can be taken by such similar words. Only capitalized and with 'k' to get the german equipollent.


----------



## ksv (Oct 12, 2005)

Squart said:
			
		

> Thank you
> 
> Yeah, that is the risk you can be taken by such similar words. Only capitalized and with 'k' to get the german equipollent.



Same with Norwegian and German


----------

