Path: utzoo!attcan!telly!lethe!torsqnt!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!brunix!ivan.uucp!jhc From: jhc@ivan.uucp (James H. Coombs) Newsgroups: comp.windows.x Subject: XtAddInput returns; error checking in general Message-ID: <64840@brunix.UUCP> Date: 13 Feb 91 16:14:42 GMT Sender: news@brunix.UUCP Reply-To: jhc@ivan.uucp (James H. Coombs) Organization: IRIS - Brown University Lines: 23 In the man page for XtAddInput()/XtAppAddInput(), I don't see any error condition to check for. The call returns an XtInputId, and I suppose that I am to treat that as opaque information. Is that right? I checked the source code, but I would like some verification on this. In the source (for X11R4), I found that XtAppErrorMsg() is called if the condition mask is invalid. That seems fair enough. But, I see a subsequent call to XtNew(), which calls malloc(). XtAddInput() then uses the result without checking for a valid pointer. It is this pointer that is returned as the XtInputId. Putting aside the fact that the current implementation of XtAddInput() will crash if the allocation fails, should I check for a NULL return? or should this truly be considered opaque? Is this an issue specific to XtAddInput()? or is there just a programming lapse in that routine? or is it a lapse in the documentation? In other words, should I just assume that all undocumented errors will be fatal? It seems inappropriate to check the source code and then check for returns based upon the current implementation. Thanks. --Jim