Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does __uuidof(someVar) do?

I found some code which is meant to call __uuidof(IMyInterface) but actually calls __uuidof(pIMyInterface) where pIMyInterface is a pointer of type IMyInterface. How does __uuidof behave when called on a value rather than a type?

e.g. int x=123; __uuidof(x) is this equivalent to __uuidof(int) or __uuidof(123)

like image 214
Mr. Boy Avatar asked Dec 14 '15 12:12

Mr. Boy


1 Answers

__uuid is a keyword, not a function. It is not "called", it is directly parsed by the compiler. Which of course has no trouble recognizing that the operand is a variable. And it knows the type of the variable so has no trouble looking up the __declspec(uuid) attribute for the type.

like image 55
Hans Passant Avatar answered Sep 19 '22 21:09

Hans Passant