Re: Including <iostream> affects whether or not program freezes?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Am Donnerstag 10 Juli 2008 schrieb James Gregory:
> A minimal version of the function which freezes is something like:
>
> bool AIInterpreter::is_group_like_this(int n_side, int n_group) {
> 	//it is the second condition (scanned_groups) which triggers this
> code branch, but deleting anything at all here removes the bug
> 	if ((!sides[n_side].groups[n_group].get_alive())
>
> 	|| !sides[my_side].scanned_groups[n_side][n_group]
> 	|| sides[n_side].groups[n_group].get_in_hangar()) {
>
> 		while (l_iter != l_end)
> 			++l_iter;
> 		return false;
> 	}
> 	write_log(L"it never gets this far");
>
> 	<the function continues but though deleting it removes the bug, the
> fact the above log never gets written means it is probably irrelevant>
> }
>
> So I guess "while (l_iter != l_end)" is becoming an infinite loop, but
> if I log the value of &(*l_iter) and &(*l_end) on each loop then a) it
> removes the bug and b) there is nothing obviously wrong. Anything else
> I can do?

Did you find the bug? What was the problem?

If you did not find it yet:

1. Check with a debugger that the while loop is indeed an endless loop.
2. You did not show what containers l_iter and l_end come from and what 
happens with the containers in this function.

Christoph

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux