asm volatile(...);
__asm__ __volatile__(...);
I see both are used; why create some duplicate stuff?
The C standard reserves 'asm' for use by users for any purpose. Therefore, GCC provides the __asm__
notation to avoid running into the user's name space (because identifiers starting with double underscore are reserved for the implementation).
The notation with the double underscore is ungainly, so GCC provides the pleasanter interface without the double underscores. But if you turn on a standard-compliant compilation mode (such as -std=c99
), the asm
option is turned off. By writing with the double underscore notation, it is always available.
So, asm
is pleasanter to read, but __asm__
is compliant with the C standard.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With