What does the type of the void * & mean parameter and its use mean?

I am looking at an API written in C ++ and am confused by what the following type of parameter means:

void*& data

Does this mean that the user will pass a link to a void pointer? If true, what's the point? I mean, void * is already indirect, so why would you want to redirect it again?

+3
source share
3 answers

, , , , . , ? - , char. , - , .

, . , , . ++ C apis. POSIX void, , ++ .

+2

void * pass-by-pointer ++, , . , , , , .

, void *& , . , , .

+6

But be careful not to return a link to a local void *. Do nothing like this:

void*& f()
{
 int* a=new int(10);
 void* x=(void*)a;
 return x;
}
+1
source

Source: https://habr.com/ru/post/1776009/


All Articles