Kim Woelders wrote: > Enlightenment CVS wrote: > >> Enlightenment CVS committal >> >> Author : essiene >> Project : e17 >> Module : proto >> >> Dir : e17/proto/entrance_edit_gui/src/widgets >> >> >> Modified Files: >> ew_entry.c ew_entry.h >> >> >> Log Message: >> - Fix return type warning when getting an etk_entry, it returns a const >> char*, but we use normal char*'s everywhere. >> >> =================================================================== >> RCS file: /cvs/e/e17/proto/entrance_edit_gui/src/widgets/ew_entry.c,v >> retrieving revision 1.7 >> retrieving revision 1.8 >> diff -u -3 -r1.7 -r1.8 >> --- ew_entry.c 16 Aug 2006 12:52:01 -0000 1.7 >> +++ ew_entry.c 16 Aug 2006 13:13:30 -0000 1.8 >> @@ -47,10 +47,10 @@ >> return ew; >> } >> >> -const char* >> +char* >> ew_entry_get(Entrance_Entry ew) >> { >> - return etk_entry_text_get(ETK_ENTRY(ew->control)); >> + return (char*) etk_entry_text_get(ETK_ENTRY(ew->control)); >> } >> >> > ... > > You should never (have to) cast away the const modifier. It is there for > a purpose. It tells you (and the compiler) that here is a pointer to a > piece of memory that you are not supposed to modify. > > The compiler warns you if you pass a const pointer to a function that > takes non-const pointer arguments, that you may be changing something > you are not supposed to change. > The compiler can also use the const modifier to make certain assumptions > used for optimization, e.g. that the content of an object is unchanged > across calling a function which takes a const pointer to the object. > > If you seem to have to cast away a const pointer to avoid compiler > warnings it is most likely because something is wrong somewhere. > thnx for bringing that up.
the full scenario is etk_entry_text_get() returns a const char*. ecore_config_string_set, takes a char*, i have to pass the value returned from etk_entry_text_get() to ecore_config_string_set(), if i use one variable, there will be warnings anyhow i do it: /*warning by ecore_config_string_set*/ const char * try1 etk_entry_text_get(...); ecore_config_string_set(key, try1); /*warning by etk_entry_text_get*/ char* try2 etk_entry_text_get(...); ecore_config_string_set(key, try2); that's why i did that. anyways... what's the best way to do this? or just ignore it? its a trivial warning *i tink* > /Kim > > ------------------------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > _______________________________________________ > enlightenment-devel mailing list > enlightenment-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/enlightenment-devel > > ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ enlightenment-devel mailing list enlightenment-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-devel