digitalmars.D.bugs - Odd delegate behavior
- nobody <nobody mailinator.com> Feb 14 2007
- Frits van Bommel <fvbommel REMwOVExCAPSs.nl> Feb 14 2007
- nobody <nobody mailinator.com> Feb 14 2007
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. ----------------
printf(" stack -> [%X]\n", opIndexDg.ptr );
printf(" stack -> [%X]\n", &opIndexAssignDg.ptr );
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:When I compile (v1.0) the following code for some reason opIndexDg's stack pointer is null and opIndexAssignDg's stack pointer is not. ----------------
printf(" stack -> [%X]\n", opIndexDg.ptr );
printf(" stack -> [%X]\n", &opIndexAssignDg.ptr );
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.
Thanks that certainly was just a typo on my part!
Feb 14 2007








nobody <nobody mailinator.com>