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

Re: widget array



u know - that's what i thought too - but it don't work with gcc on Sun.


Bryan Wilkinson wrote:
> 
> > however, there are more pressing matters to attend to - u have
> > >  *((GtkWidget **)widgetPtr +1)
> > this is a core dump waiting to happen. on 32 bit machines pointers are 4 bytes
> > so
> > it should be + 4; it is much easier (and safer/portable) to do +
> > sizeof(widgetPtr) - which
> > should give u the pointer size in bytes.
> 
> pointer arithmetic causes widgetPtr + 1 to be the same as &widgetPtr[1].
> using widgetPtr + sizeof(widgetPtr) is not what the person wants, they
> want the address of the next element in the array, in which case +1 is
> correct.
> 
> --
>          To unsubscribe: mail gtk-app-devel-list-request@redhat.com with
>                        "unsubscribe" as the Subject.
> 
>         Mailing list concerns should be mailed to <listmaster@redhat.com>



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