Inline Assembly in XCode 4.0

Joined
Jun 28, 2011
Messages
2
Reaction score
0
Points
1
Anyone else attempt Inline Assembly in XCode 4. I hate GCC's syntax (I mean seriously..... ). I got my old inline asm working (from version 3) by changing the complier from LLVM 2.0 to LLVM GCC 4.2. I can now compile the following code:

Code:
int test = 0;

asm
{
    pusha
    
    mov eax, test
    inc eax
    inc eax
    inc eax
    mov test, eax
    
    popa
}

printf("Result: %d\n", test);

The code compiles, and executes without error, but the editor still thinks the code is in error (even though it compiles). I am getting an error "expecting '(' after 'asm'". Clearly the parser is not working. Anyone know how to fix this? Or anyone know of a better way to enable normal inline asm syntax.

P.S. Please do not comment about how I should not be using asm, I have my reasons.
 
OP
R
Joined
Jun 28, 2011
Messages
2
Reaction score
0
Points
1
I was able to get the error to "go away" by turning off "Enable Live Issues". This is sort of a hack.... but to be honest I don't like the feature anyways. Its annoying when you write

Code:
unsigned int

and then sit there for a second thinking of a name, when all of a sudden the editor is telling you your code is wrong. No ****.... I'm not finished yet.
 
Joined
Feb 14, 2012
Messages
1
Reaction score
0
Points
1
Thank you so much!

Today in my computer science class we were learning inline assembly in MS Visual Studio, I tried to do the code in Xcode (my preferred coding platform) and I kept getting an error message. I tried googling an answer but I kept getting results for iPhone ARM assembly.
I happen to find this post later on and now I've realized that the error is just an Xcode quirk and that in fact, the syntax

Code:
__asm__
{
  mov eax, a ; more assembly code.....
}

works fine! Thanks for the info!
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top