How C Code Looks in Assembler

ivanjs

Registered
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

Registered
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

Registered
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

Registered
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.
 

ksv

web developer
Squart said:
Thank you :D

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 :D
 
Top