Re: const char *
"Rich Mattes" <[email protected]>
| Newsgroups | gmane.science.robotics.playerstage |
|---|---|
| Message-ID | <000001cb356d$5c2cac10$14860430$@com> |
It looks like the compiler is treating "crabbing" as a const-qualified string. Since none of the set/get functions are expected to modify the key string you pass, it seems sane to modify all of them to accept const arguments (this guarantees that the function will just be looking at the value of the string, and won't modify it.) You could go through and change all of the c/c++ client code to use const chars as arguments. It would probably require a lot of work; in order to preserve the const qualifier in libplayerc you'd have to change the player_*prop_req_t structs (in libplayerinterface/player.h) so the property string is a const, then you'd have to change all the c and c++ function prototypes and definitions, etc. As a workaround, you might also be able to do something like: char* property = "crabbing"; pp->SetIntProp(property,1); This should get gcc off your back since you'd be passing a plain old char* like it wants. Rich -----Original Message----- From: Fred Labrosse [mailto:[email protected]] Sent: Thursday, August 05, 2010 11:51 AM To: [email protected] Subject: [Playerstage-developers] const char * All, Whenever I call: pp->SetIntProp("crabbing", 1); my compiler complains: warning: deprecated conversion from string constant to 'char*' So I started editing clientproxy.h and clientproxy.cc in my svn working copy to add the const's with a view of submitting a patch. Obviously, the compilation fails because the underlying c code (in playerc.h) does not have the const's. I haven't done any pure c in a while so I'm not too sure what to do with that. I think gcc will be happy with added "const"s but this might not be generic enough. And I'm not too sure what the repercussions of that will be with the rest of the code. I could const_cast, but this somehow defeats the point... Any suggestions? Cheers, Fred ---------------------------------------------------------------------------- -- The Palm PDK Hot Apps Program offers developers who use the Plug-In Development Kit to bring their C/C++ apps to Palm for a share of $1 Million in cash or HP Products. Visit us here for more details: http://p.sf.net/sfu/dev2dev-palm _______________________________________________ Playerstage-developers mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/playerstage-developers ------------------------------------------------------------------------------ This SF.net email is sponsored by Make an app they can't live without Enter the BlackBerry Developer Challenge http://p.sf.net/sfu/RIM-dev2dev