Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the meaning of void* volatile* in c++

Tags:

I am looking at the following code:

inline void* interlocked_read_acquire(void* volatile* x); 

and am wondering why not just a volatile void* as an argument. In general what is the semantics or definition of a volatile*? I am also making the assumption that you could use the volatile* qualifier with any other type besides void. Is that correct?

like image 608
Matthew Hoggan Avatar asked Nov 28 '14 03:11

Matthew Hoggan


1 Answers

Use cdecl or the clockwise spiral rule to decipher C-style declarations :

void* volatile* x 
  • declares x as pointer to volatile pointer to void

which is different from :

volatile void* x 
  • declare x as pointer to volatile void
like image 91
quantdev Avatar answered Sep 21 '22 12:09

quantdev