- 1
How Manny arguments void can return
3 Answers
+ 4
At least 1 appearently :)
#include <iostream>
#ifdef __GNUC__
// Returns the argument passed to it
void returnSomething( int i )
{
__asm__ __volatile__( "mov %0, %%eax" : : "r"( i ) : "eax" );
}
#endif
int main()
{
#ifdef __GNUC__
returnSomething( 8 );
int i;
__asm__ __volatile__( "mov %%eax, %0" : "=r"( i ) : : "eax" );
std::cout << i; // prints 8
#endif
}
Just in case...: void returns nothing, but that doesn't mean you can't work around it. :)
0
And what about pointer arguments?
0
Still 1 m8, the pointer itself may point to an array or something but only the pointer itself is returned.