www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - docs: offset is undocumented

The struct member property "offset" is essentially undocumented (yes, 
it's on http://www.digitalmars.com/d/ctod.html, but I think it should be 
on http://www.digitalmars.com/d/struct.html, too).

Here's an example of how it works (and how it doesn't work):

import std.stdio;

struct S
{
     int bar;
}


void main()
{
    S myStruct;

    /* These do work: */
    writefln(S.bar.offset);
    writefln(typeof(myStruct).bar.offset);

    /* I think this should work (but it doesn't). */
// writef(myStruct.bar.offset);
// no property 'offset' for type 'int'


    /* This shouldn't work (and it doesn't). */
// writef(myStruct.offset);
// no property 'offset' for type 'S'

}


(This post was inspired by discussion from this thread:
digitalmars.D.bugs/730)

-- 
Justin (a/k/a jcc7)
http://jcc_7.tripod.com/d/
Jul 25 2004