[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [E-devel] E CVS: proto essiene
Kim Woelders wrote:
Enlightenment CVS wrote:
Enlightenment CVS committal
Author : essiene
Project : e17
Module : proto
Dir : e17/proto/entrance_edit_gui/src/widgets
- 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 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(...);
/*warning by etk_entry_text_get*/
char* try2 etk_entry_text_get(...);
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*
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
enlightenment-devel mailing list