Disabling “cast from pointer to smaller type uint32_t” error in Clang

后端 未结 5 2293
灰色年华
灰色年华 2021-02-15 12:07

I\'m working on a school project that involves porting a large piece of C++ code on an experimental piece of hardware. Unfortunately, that hardware is 64-bit and the code contai

5条回答
  •  清酒与你
    2021-02-15 12:29

    I hit this same problem in a project without C++11, and worked around it like this:

    inline int PtrToInt(void* ptr)
    {
        void* clang[1];
        clang[0] = ptr;
        return *(int*)clang;
    }
    

提交回复
热议问题