NAME
XtCheckSubclass − verify an object’s class, if compiled with DEBUG defined.
Synopsis
void XtCheckSubclass(object, object_class, message)
Widget object;
WidgetClass object_class;
String message;
Inputs
objectSpecifies the object; may be of class Object or any subclass thereof.
object_class
Specifies the widget class to test against; may be objectClass or any subclass thereof.
messageSpecifies the message to be displayed if object is not a subclass of object_class.
Description
XtCheckSubclass() checks that object is of class object_class or a subclass. If it is not, XtCheckSubclass() calls XtErrorMsg() passing message as the default message to be displayed. XtErrorMsg() displays the message and terminates the application. XtCheckSubclass() is implemented as a macro which only performs the check if compiled with the symbol DEBUG defined (i.e., if the C compiler is invoked with the flag
−DDEBUG).
Usage
XtCheckSubclass() is intended for use similar to the POSIX assert() macro while developing and debugging a widget or an application. It should be used in all application and widget-internal functions that might inadvertently be passed an object of the wrong type. Public functions exported by a widget should always check a widget’s class (not just when DEBUG is defined) using XtIsSubclass() or a related function because even if a widget is bug-free, an application programmer may still pass an object of the wrong type to the widget.
See Also
XtClass(1), XtIsSubclass(1), XtSuperclass(1),
Core(3).
Copyright O’Reilly & Assoc. — X Toolkit Intrinsics Reference Manual © O’Reilly & Associates