Static arrays inside struct and class - bug?
BBasile via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sat Aug 1 10:33:18 PDT 2015
On Saturday, 1 August 2015 at 17:22:40 UTC, NX wrote:
> I wonder if the followings are compiler bugs:
>
> class stuff_class
> {
> byte[1024*1024*16] arr; // Error: index 16777216 overflow
> for static array
> }
>
> struct stuff
> {
> byte[1024*1024*16] arr; // Error: index 16777216 overflow
> for static array
> }
>
> My project has just stopped for this reason, I was trying to
> hack into another process memory with something similar to this:
> stuff data;
> ReadProcessMemory(Proc, (void*)0xA970F4, &data,
> stuff.sizeof, null);
> Target program is written in C++ and because of this limitation
> I'm not able to write equivalent code and here I'm stuck.
There a limit for static array size. This limits is exactly 16MB
so 1024*1024*16.
Remove one element:
byte[1024*1024*16-1] arr;
More information about the Digitalmars-d-learn
mailing list