[Issue 4546] New: D2 Language Docs: http://www.digitalmars.com/d/2.0/type.html

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Aug 1 08:59:51 PDT 2010


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

           Summary: D2 Language Docs:
                    http://www.digitalmars.com/d/2.0/type.html
           Product: D
           Version: D2
          Platform: Other
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: www.digitalmars.com
        AssignedTo: nobody at puremagic.com
        ReportedBy: andrej.mitrovich at gmail.com


--- Comment #0 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2010-08-01 08:59:50 PDT ---
"Implicit Conversions"

The last line is wrong, replace the example with:


enum Foo { E }
Foo f;
int i;
i = f;              // OK
f = i;              // error
f = cast(Foo)i;     // OK
f = 0;              // error
f = f.E;            // OK



"Delegates"

In the example, a non-constructed class has it's member function
assigned to a delegate. Also, the two functions have no body and this 
will make the linker spit out nonsense.

Replace with:


int func(int) { return 0; };

class OB
{   
    int member(int) { return 0; };
}    

void main() {
    int function(int) fp;       // fp is pointer to a function
    int delegate(int) dg;       // dg is a delegate to a function
    fp = &func;                 // fp points to func
    OB o = new OB;
    dg = &o.member;             // dg is a delegate to object o and
                                // member function member    
}

-- 
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