logoalt Hacker News

bigfishrunningtoday at 12:24 PM1 replyview on HN

I would argue that inline assembly, while not in the standard, is really just a convenience feature -- it is part of the standard to declare an extern reference to a function in the symbol table and jump to it, it just requires a separate ASM object to link alongside your C object. Inline assembly doesn't allow anything you can't do without it.


Replies

convolvatrontoday at 1:07 PM

that's kind of not true. inline asm lets me refer to the register that the compiler placed a value in.

lets say I really want to use popcnt in my inner loop. with inline assembly I can just shove it in there. external linkage forces a function call overhead that can't be inlined, which obviates any benefit I might have had from using the specialized instruction.

show 1 reply