August 01, 2010 [Issue 4546] New: D2 Language Docs: http://www.digitalmars.com/d/2.0/type.html | ||||
---|---|---|---|---|
| ||||
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@puremagic.com ReportedBy: andrej.mitrovich@gmail.com --- Comment #0 from Andrej Mitrovic <andrej.mitrovich@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: ------- |
February 02, 2011 [Issue 4546] D2 Language Docs: http://www.digitalmars.com/d/2.0/type.html | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrej Mitrovic | http://d.puremagic.com/issues/show_bug.cgi?id=4546 Andrej Mitrovic <andrej.mitrovich@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |INVALID --- Comment #1 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2011-02-01 17:35:35 PST --- First part: I've no idea what the "i" in the enum example is, it's not actually defined as an int on the website even though in the first comment I labeled it as int for some reason. Second part: Examples don't have to work, they're just demonstrating the syntax. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation