This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Still having NULL woes...
- To: egcs at cygnus dot com
- Subject: Still having NULL woes...
- From: Mark Schaefer <mschaefer at dsai dot com>
- Date: Sat, 11 Apr 1998 14:12:42 -0600
- Organization: Decision-Science Applications, Inc.
Egcs developers,
I'm still having trouble with the "Magic pointer __null" as well as
"const int Null = 0" in use as a pointer-to-member-class-function. This
is an example of what I mean, but I haven't tested it to verify the
error pops up.
file UiCallbackHandler.H has the following code snippet
class UiCallbackHandler
{
public:
typedef void (UiCallbackHandler::*callbackProc)(Widget,
XtPointer, XtPointer);
};
file UiMessageBox.H has this code:
const int Null = 0;
class UiMessageBox : public UiCallbackHandler {
public:
enum messageType {info, error, question, warning, working, retry};
enum modeType {systemModal, primaryAppModal, fullAppModal,
modeless};
static UiMessageBox* create
(const char* message,
Widget parent,
messageType type = info,
UiCallbackHandler* client = Null,
callbackProc okCallback = Null,
XtPointer okClientData = Null,
callbackProc cancelCallback = Null,
XtPointer cancelClientData= Null,
modeType mode =
modeless);
~UiMessageBox ();
};
In the client app, I get the following errors:
UiMessageBox.H:59: warning: invalid type `int' for default argument to
`UiCallbackHandler *'
UiMessageBox.H:59: warning: invalid type `int' for default argument to
`void (UiCallbackHandler::*)(_WidgetRec *, void *, void *)'
UiMessageBox.H:59: warning: invalid type `int' for default argument to
`void *'
UiMessageBox.H:59: warning: invalid type `int' for default argument to
`void (UiCallbackHandler::*)(_WidgetRec *, void *, void *)'
UiMessageBox.H:59: warning: invalid type `int' for default argument to
`void *'
UiMotifDisplay.C: In function `static void
UiMotifDisplay::keyboardInput(struct _WidgetRec *, void *, union _XEvent
*, char *)':
UiMotifDisplay.C:650: no matching function for call to
`UiMessageBox::create (char[79], _WidgetRec *&,
UiMessageBox::messageType, const int &, const int &, const int &, const
int &, const int &, UiMessageBox::modeType)'
UiMessageBox.H:59: candidates are: UiMessageBox::create(const char *,
_WidgetRec *, UiMessageBox::messageType, UiCallbackHandler *, void
(UiCallbackHandler::*)(_WidgetRec *, void *, void *), void *, void
(UiCallbackHandler::*)(_WidgetRec *, void *, void *), void *,
UiMessageBox::modeType)
The errors for __null are very similar, except that it reports
UiMotifDisplay.C:650: cannot convert `0' from type `{unknown type} *' to
type `void (UiCallbackHandler::*)(_WidgetRec *, void *, void *)'
UiMotifDisplay.C:650: cannot convert `0' from type `{unknown type} *' to
type `void (UiCallbackHandler::*)(_WidgetRec *, void *, void *)'
These are also the errors if NULL is #defined as (0)
Any helpful hints??
--
Mark Schaefer