??? 11/03/08 21:54 Read: times |
#159594 - Inline assembler - Avoid! Avoid!! Responding to: ???'s previous message |
Jan Waclawek said: (my emphasis)
I see no difference between asm in a separate module and a purely asm function inlined to a C source Ah - now, if it were properly structured as a separate function, that shouldn't be such a problem - but why bother with inlining it if you've gone to all the trouble of making it a function anyhow? No, the usual "reason" for requesting inline assembler is just to sprinkle the odd assembler instruction or two randomly in the 'C' source to fiddle directly with hardware registers, the Stack Pointer, or somesuch. As you can imagine, this is extremely dnagerous and a great way to wreak havoc in your program! If you thought 'C' gave enough sharp knives for the careless user to seriously maim themselves, then inline assembler is like adding guns, high explosives, petrol and matches!! Usually there is no reason for it at all - because the compiler either provides the facility in 'C' (possibly as an extension), or omits it for precisely the rason that it is a Really Bad Idea! |