[Issue 5176] Limit static object sizes

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Mar 20 04:50:31 PDT 2012


http://d.puremagic.com/issues/show_bug.cgi?id=5176



--- Comment #11 from deadalnix <deadalnix at gmail.com> 2012-03-20 04:50:47 PDT ---
(In reply to comment #10)
> (In reply to comment #6)
> > One possibility is to allow arbitrary sizes but have the compiler insert checks
> > for all field accesses through pointer or reference when the field offset is
> > beyond the OS's protected area.
> 
> That'd work. It'd introduce uneven performance characteristics, but that could
> be the price to pay for safety. (To not pay this price we'd need
> statically-enforced non-nullable pointers.)
> 
> On second thought, it needs a little tweak. Take this example:
> 
> struct A {
>   /* a lot of fields */
>   int f; // offset is 3 Kb - 4 bytes
> }
> struct B {
>   A a1; // field offset is 0
>   A a2; // field offset is 3 Kb
> }
> 

Classes are references types. So both a1.f and a2.f will have the same offset.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list