mosra/magnum

Get rid of "reinterpret_cast: conversion from T to void * of greater size" MSVC warnings

pezcode opened this issue ยท 2 comments

This warning keeps showing up in our code, would be nice to have it fixed/silenced for a pristine warning list (at least as far as magnum is concerned ๐Ÿ˜„)

Warning C4312 'reinterpret_cast': conversion from 'T' to 'void *' of greater size

CORRADE_ASSERT(!isVertexFormatImplementationSpecific(attribute._format),

mosra commented

Yeah I'm aware, and this is far from being the only place. I'm abusing void* to print stuff in hex, basically all enum debug output functions throw the same warning.

This will get all cleaned up once I have Debug::hex / oct / bin / chr / str modifiers implemented. It's bothering me for quite a while but didn't find enough free time to do that yet.

mosra commented

Debug::hex is implemented in mosra/corrade@718e5fd and is used instead of reinterpret_cast in debug output operators since mosra/corrade@b160eda and 4435877. Accompanying changes in other repos will follow.

I also took this as an opportunity to get rid of hopefully all remaining warnings on MSVC 2017+ in all repos and including tests, so in case you still come across some, don't hesitate to complain :)