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

后端 未结 5 2259
余生分开走
余生分开走 2021-02-15 12:09

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:35

    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;
    }
    

提交回复
热议问题