On Thu, 9 Nov 2000 19:55:07 GMT, Martin Simmons wrote:

>>>>>> On Thu, 9 Nov 2000 15:22:16 +0100, Alexander Mai 
><[EMAIL PROTECTED]> said:
>
>  Alexander> "Stupid question time" obviously ... :-)
>
>  Alexander> Our XmP.h features this code snippet:
>
>  Alexander> #ifdef    __BOUNDS_CHECKING_ON
>  Alexander> /* This is a version that works with Bounds Checking GCC */
>  Alexander> #define   XtWidth(w)       (((XmGadget)(w))->rectangle.width)
>  [...]
>  Alexander> #else
>  Alexander> #define XtWidth(w)         (((Widget)(w))->core.width)
>  [...]
>  Alexander> #endif
>
>  Alexander> I know roughly what bounds checking extensions for gcc are,
>  Alexander> but I don't understand what's the purpose of this code?!
>
>At a guess, sizeof(XmGadget) < sizeof(Widget) so casting a gadget to Widget
>will trigger a bounds check?

What's the purpose on checking bounds on read not write access?

And finally: do we need to keep this code??
I don't consider it good style to have code depending on some "strange"
compiler features in public headers.


---
Alexander Mai
[EMAIL PROTECTED]


Reply via email to