asm and __asm__ ?

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
nullify

asm and __asm__ ?

Post by nullify »

I've seen code that uses both ways, and both are accepted by gcc. Is there any reason to choose one spelling over another? Or is it just one of those backwards compatibility things?
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:asm and __asm__ ?

Post by Pype.Clicker »

__asm__ still exists when -ansi is specified, while asm() isn't ansi ;)
Tim

Re:asm and __asm__ ?

Post by Tim »

I remember reading that [tt]asm[/tt] is the same as [tt]__asm__ __volatile__[/tt]. Something to do what the optimiser is allowed to do; I don't think the optimiser is allowed to move __asm__ __volatile__ blocks around, whereas it is allowed to reorder __asm__ blocks. Don't quote me on that, though.
nullify

Re:asm and __asm__ ?

Post by nullify »

Thanks for your replies. Since __asm__ seems to be more explicit and standard, I guess I'll stick with it.
Post Reply