digitalmars.D.bugs - Odd delegate behavior
- nobody (32/32) Feb 14 2007 When I compile (v1.0) the following code for some reason opIndexDg's sta...
- Frits van Bommel (7/13) Feb 14 2007 [snip]
- nobody (2/16) Feb 14 2007 Thanks that certainly was just a typo on my part!
When I compile (v1.0) the following code for some reason opIndexDg's stack pointer is null and opIndexAssignDg's stack pointer is not. ---------------- struct S { real delegate(size_t i, size_t j) opIndexDg; real delegate(real r, size_t i, size_t j) opIndexAssignDg; void dbg() { printf("&opIndexDg : [%X]\n", &opIndexDg ); printf(" func -> [%X]\n", opIndexDg.funcptr ); printf(" stack -> [%X]\n", opIndexDg.ptr ); printf("&opIndexAssignDg : [%X]\n", &opIndexAssignDg ); printf(" func -> [%X]\n", opIndexAssignDg.funcptr ); printf(" stack -> [%X]\n", &opIndexAssignDg.ptr ); } }; int main(char[][] args) { S s; s.dbg(); return 0; } ---------------- Output: ---------------- &opIndexDg : [12FF28] func -> [0] stack -> [0] &opIndexAssignDg : [12FF30] func -> [0] stack -> [12FF30]
Feb 14 2007
nobody wrote:When I compile (v1.0) the following code for some reason opIndexDg's stack pointer is null and opIndexAssignDg's stack pointer is not. ----------------[snip]printf(" stack -> [%X]\n", opIndexDg.ptr );[snip]printf(" stack -> [%X]\n", &opIndexAssignDg.ptr );^ You have an extra '&' here If you remove that it should also be null (it was for me). The address you were printing was where the null pointer was stored, not the null pointer itself :P.
Feb 14 2007
Frits van Bommel wrote:nobody wrote:Thanks that certainly was just a typo on my part!When I compile (v1.0) the following code for some reason opIndexDg's stack pointer is null and opIndexAssignDg's stack pointer is not. ----------------[snip]printf(" stack -> [%X]\n", opIndexDg.ptr );[snip]printf(" stack -> [%X]\n", &opIndexAssignDg.ptr );^ You have an extra '&' here If you remove that it should also be null (it was for me). The address you were printing was where the null pointer was stored, not the null pointer itself :P.
Feb 14 2007