Le 27/01/2012 17:14, Willem Jan Palenstijn a écrit :
On Fri, Jan 27, 2012 at 05:07:56PM +0100, Julien Puydt wrote:
Le 27/01/2012 17:02, Julien Puydt a écrit :
Le 27/01/2012 16:52, Willem Jan Palenstijn a écrit :
Is char signed or unsigned on your platform?

Good question ; how do I find out?

If I put the following in test.c :

#include<limits.h>
#include<stdio.h>

int
main()
{
   printf ("%d\n", CHAR_MIN);
   return 0;
}


then compile and run it, I get 0 ; so I guess it's unsigned.

Indeed. That will mean that the initialization of neighborhoods to (char)-1
will have the effect that the check

     if neighborhoods[current]<  0:

fails because (char)-1 is positive, which will no doubt cause the algorithm to
break completely.

I added a few "unsigned" keywords here and there and got the test right!

I'll open a ticket with a nice patch as soon as I'll have cleaned things a little.

Thanks for the help!

Snark on #sagemath

--
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to