Re: subtle bug possibility
- From: Owen Taylor <owt1 cornell edu>
- To: Nathan Froyd <maestrox geocities com>
- Cc: gtk-list redhat com
- Subject: Re: subtle bug possibility
- Date: 09 Mar 1998 15:38:08 -0500
Nathan Froyd <maestrox@geocities.com> writes:
> This code doesn't want to run on gtk 0.99.3:
>
> for(i=0;i<4;i++){
> column[i] = gtk_hbox_new(TRUE, 3);
> for(j=0;j<4;j++){
> drawbox[(i+1)*(j+1)+(3-j)*i] = gtk_drawing_area_new();
This, and similar statements look like the problem to me.
Expanding the bracketed expression, we get
i*j + i + j + 1 + 3*i - i*j = 4*i + j + 1
But the indices should be 0..15. So you probably wanted simply:
drawbox[4*i + j] = ....
Hope this helps,
Owen
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]