P
P
Pavel K2016-03-07 02:23:39
Qt
Pavel K, 2016-03-07 02:23:39

Is it possible to learn from a function a pointer to a variable where it returns a value, without explicitly specifying it in the O_o parameters?

Greetings!
In general, subject =)
For example:

int myFunction() 
{
....
*mf = 123;
....
}

void main()
{
int mf = myFunction();
 qDebug()<<"mf"<<mf;
}

I'm interested out of pure interest - I'm ready for hellish crutches and not cross-platform, the MinGW compiler.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
jcmvbkbc, 2016-03-07
@PavelK

Is it possible to learn from a function a pointer to a variable where it returns a value

In general, no. If the return value is a primitive type or a small structure (fitting into 1 - 2 registers, depending on the ABI), then this value is returned in the register(s) and may not be written to memory anywhere at all. If a large structure is returned, then the address where it should be written is passed to the function as an additional hidden parameter.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question