_ADDRESSOF(v) macro definition in VS2019 C++

Viewed 52

In <vadefs.h> you'll find the following definition for the macro _ADDRESSOF(v) in VS2019:

#ifdef __cplusplus
    #define _ADDRESSOF(v) (&const_cast<char&>(reinterpret_cast<const volatile char&>(v)))
#else
    #define _ADDRESSOF(v) (&(v))
#endif

I'd like to understand the first definition above, when __cplusplus is defined. Why does it work?

0 Answers
Related