Albrecht Schlosser wrote:
> I don't think that a union would help, because this would maybe leave
> undefined bits in the user_data_ member, depending on the access to the
> union.

        Unused bits would be OK I think, since any code using argument()
        would surely only use that method to access/read the data.

        Maybe just a warning in the docs that if you try to mix the use
        of argument() and user_data() the behavior is undefined.

        To be safe, we could set user_data to zero before passing the
        long into it, to ensure any 'unused bits/bytes' would be zero.

> Using casts and storing the full data size seems more appropriate
> to me.

        Yes, that's likely better, assuming there's a solid
        cross platform way to do it. (intptr_t sounded like it was
        'optional'..?)

        I figure if sizeof(long) is ever != sizeof(void*), the above
        problem of access will exist unless argument() is used exclusively
        to manipulate the value (ie. no half-and-half use of it)

        But I defer to you guys on this.
_______________________________________________
fltk-dev mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-dev

Reply via email to