digitalmars.D.bugs - Recursive function calls being skipped
- Derek Parnell (37/37) Apr 23 2007 I have a situation like this ...
- BCS (10/44) Apr 23 2007 First I'd do this
I have a situation like this ...
void Foo(T)(T pData)
{
T xx;
writefln("ENTRY");
// skip a whole lot of code ...
if (some_condition)
{
writefln("A");
Foo( xx );
Writefln("B");
}
// blah blah blah ...
writefln("EXIT");
}
And the output I'm getting is ...
ENTRY
A
B
EXIT
but I was expecting ...
ENTRY
A
ENTRY
EXIT
B
EXIT
The code is inside a very large program so I'm a bit loathed to start
chopping it up to find the minimum program that still demonstrates the
effect. I suppose I could examine the object code to see what's being
generated but I was hoping that someone might give me a clue first.
--
Derek
(skype: derek.j.parnell)
Melbourne, Australia
"Justice for David Hicks!"
24/04/2007 9:57:44 AM
Apr 23 2007
Reply to Derek,
I have a situation like this ...
void Foo(T)(T pData)
{
T xx;
writefln("ENTRY");
// skip a whole lot of code ...
if (some_condition)
{
writefln("A");
Foo( xx );
Writefln("B");
}
// blah blah blah ...
writefln("EXIT");
}
And the output I'm getting is ...
ENTRY
A
B
EXIT
but I was expecting ...
ENTRY
A
ENTRY
EXIT
B
EXIT
The code is inside a very large program so I'm a bit loathed to start
chopping it up to find the minimum program that still demonstrates the
effect. I suppose I could examine the object code to see what's being
generated but I was hoping that someone might give me a clue first.
First I'd do this
void Foo(T)(T pData)
{
T xx;
writefln("ENTRY");
scope(exit)writefln("EXIT");
[...]
}
That will make sure that no exceptions are messing you up.
Apr 23 2007








BCS <ao pathlink.com>