[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: problem with g++ 2.9



On Tue, Mar 05, 2002 at 07:38:08PM +0800, a wrote:
> From: "Eric G. Miller" <egm2@jps.net>
> > On Tue, Mar 05, 2002 at 03:20:12PM +0800, a wrote:
> > > in my c++ program i write:  
> > > XtAddCallback(entry, XtNcallback, print_string, "one");
> > > 
> > > g++ 2.9 complains:
> > > xzip.cpp: In function `int main(int, char **)':
> > > xzip.cpp:35: passing `const char *' as argument 4 of
> > > `XtAddCallback(_WidgetRec *, const char *,
> > > void (*)(_WidgetRec *, void *, void *), void *)' discards qualifiers
> > > 
> > > earlier g++ does not complain
> > 
> > Well, it's a valid warning.  If the callback tried to modify the
> > argument...  Segfault?  I presume, it didn't actually cause the program
> > not to compile.
> 
> thanks!
> but it's not warning; it doesn't compile.

You'll need to fix your program, then, as the function prototype of
XtAddCallback() does say that the fourth argument might be modified.
Perhaps put the string in a buffer somewhere rather than passing it as a
constant.

-- 
Colin Watson                                  [cjwatson@flatline.org.uk]



Reply to: