Roger Stringer wrote:


Subject: Re: Debug app works, Release doesn't
From: "Chris Tutty" <[EMAIL PROTECTED]>
Date: Fri, 7 Jan 2005 15:23:11 +1300

From: "Robert Moynihan" <[EMAIL PROTECTED]>
> (char*) s = CtlGetLabel(GetObjectPtr(ReadyButton));
>
> ... that might get rid of your error message, but might not solve the
> problem that you are asking about.
>
How on earth is this going to make any difference?  Aside from
the questionable approach of trying to eliminate a warning rather
than fix the underlying problem, how would casting a variable
defined as char * to char * change anything.


When you are dealing with a weird problem, the first step is to go through the program and resolve all the compiler warnings. This is not a questionable approach, but a desirable first step.

However, casting a "const char*" to a "char *" is clearly the wrong way to fix the warning,. If a function returns a "const char*", then you should keep the variable type since the compiler will then warn you if you try to modify the memory area it points to.

Roger Stringer
Marietta Systems, Inc. (www.rf-tp.com)

Agreed. The solution to this particular warning message would likely be to have written the code thus:


const char *s;
s = CtlGetLabel(GetObjectPtr(ReadyButton));

Bob


-- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/

Reply via email to