How can I tell Bloodshed+minGW to produce assembler output? I'm curious to see what it's doing with my code, but can't find anything in the GCC/Bloodshed docs.
How can I tell Bloodshed+minGW to produce assembler output? I'm curious to see what it's doing with my code, but can't find anything in the GCC/Bloodshed docs.
gcc -S prog.c
Produces
prog.s
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
Ah! I was using lower case -s. I'll try again. Ta.
I'm glad you brought this up Jez! I'm going to be reading this after school today:
Inline Assembly HowTO GCC I've always been afraid of Assembly.
--EDIT--
Or you were asking something else, nvm :(
Funny, I read that yesterday kleid-0.
No, I just wan't the intermediate assembler code that is produced from my C code. (To see why it runs so incredibly fast). In particular I'm wondering how minGW is implementing a large switch statement.
BTW what's nvm?
Switches are ugly in asm. Lots of short jumps and conditionals. You'd be surprised how much code goes into a simple C switch.
Well, I looked at it, I think it's produced a jumptable, which is nice. It'll save me making one.
Is there a way I can get the compiler to add the source lines as comment to the assembler?
Not really. And if you could it wouldn't really follow that well. The compiler will optimize some basic stuff without you even asking so the assembly code might not follow your C code. And once you turn on the optimization levels it can really look nothing like your C code.