Page 1 of 1

asm and __asm__ ?

Posted: Sun Aug 17, 2003 8:25 am
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?

Re:asm and __asm__ ?

Posted: Sun Aug 17, 2003 9:01 am
by Pype.Clicker
__asm__ still exists when -ansi is specified, while asm() isn't ansi ;)

Re:asm and __asm__ ?

Posted: Sun Aug 17, 2003 9:14 am
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.

Re:asm and __asm__ ?

Posted: Sun Aug 17, 2003 11:04 am
by nullify
Thanks for your replies. Since __asm__ seems to be more explicit and standard, I guess I'll stick with it.