This is basically another way to do the undefined operation thing.
asm:
Not part of standard C, so whatever
asm does is implementation defined, i.e., the people who wrote
gcc
Since it's not mentioned in
ISO C standard (n1570 draft-- C2011), but mentioned in annex J (common extensions):
Quote:
J.5.10 The asm keyword
1 The asm keyword may be used to insert assembly language directly into the translator output (6.8). The most common implementation is via a statement of the form:
asm ( character-string-literal );
Annex J is informative, not normative, so an implementation need not provide inline assembly, and if it does it's not prescribed in which form. But it's a widespread extension, though
not portable since compilers do indeed implement it differently.
In the C++ standard (n3376 draft of the C++11 standard), it is NOT mentioned in the body of the standard.
Quote:
7.4 The asm declaration [dcl.asm]
1 An asm declaration has the form
asm-definition:
asm ( string-literal ) ;
The asm declaration is conditionally-supported; its meaning is implementation-defined. [ Note: Typically it is used to pass information through the implementation to an assembler. - end note ]
I think Rudi correct. Try using return statements. That return values used by the calling code. Other than learning what not to do for reasonable code, what does this do for you? If you had not asked here your might have accidentally created a horrible bug in a piece of code that you thought was okay. It's okay with me, but it does not seem all that helpful....