D: Declaring empty pointer variables that return address inside function calls?
H. S. Teoh
hsteoh at qfbox.info
Thu Nov 23 20:00:31 UTC 2023
On Thu, Nov 23, 2023 at 07:22:22PM +0000, BoQsc via Digitalmars-d-learn wrote:
> Is it possible to declare empty pointer variable inside function calls
> and pass its address to the function?
>
> These are sometimes required while using Win32 - Windows Operating
> System API.
>
> * Empty pointer variables are used by functions to return information
> after the function is done.
>
> My own horrible **suggestion** of empty pointer declaration inside
> function call:
> `someFunction(uint & passingEmptyVariableForWrite);`
>
> What it would do:
> * A new variable is declared inside function call.
> * Address of that variable is passed to the function.
> * After function is done, you can refer to it for returned value.
What's wrong with:
uint* result;
someFunction(&result);
// use *result
?
T
--
One Word to write them all, One Access to find them, One Excel to count them all, And thus to Windows bind them. -- Mike Champion
More information about the Digitalmars-d-learn
mailing list