visual c++ - MSVC2013 how to declare reference to array at arbitry address? -
this works:
char anarray[256] = {}; char (&reftoanarray)[256] = anarray; this fails:
char (&reftoanarrayatarbitryaddress)[256] = *reinterpret_cast<char(*)[256]>(0xdeadbeef); with:
error c2101: '&' on constant why fail , how fix it?
p.s i'm aware casting 0xdeadbeef pointer 256 element array dangerous, 32-bit game hack need it.
seems compiler bug, workaround is:
char(* const cthearray)[256] = reinterpret_cast<char(* const)[256]>(0xdeadbeef); char(& thearray)[256] = *cthearray;
Comments
Post a Comment