[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Wierd Warning
From: |
Chris B. Vetter |
Subject: |
Re: Wierd Warning |
Date: |
Wed, 19 Mar 2003 09:24:42 -0800 |
On Wed, 19 Mar 2003 05:20:48 -0800 (PST)
"Frank D. Engel, Jr." <fde101@yahoo.com> wrote:
> Uh... you seem to miss the point here. The whole explanation for
No I don't :-)
> returning a CONSTant pointer is that the caller should NEVER change
> the data it points to. Casting to a non-CONST pointer allows
> assignment to the mutable-type pointer, but it still results in
> potentially changing the data that the CONSTant pointer pointed to,
> which you should not be doing. Instead, you should make a COPY of
> that data, and work with the COPY.
Yes, I know the difference between 'const char *' and 'char *' ;-)
> The warning you recieved should have pointed to the earlier line,
> where you made the cast; that is much more likely to be a problem.
The type cast actually is about 6 lines before the call to initPattern()
while the lines in between are completely unrelated to both.
Besides that, WHY then did it compile cleanly and not complain while
initPattern() was a static function "inside" the Foobar.m class file?
It just doesn't make sense to suddenly dump a warning, just because the
function now is "external".
--
Chris
- Re: Wierd Warning, Frank D. Engel, Jr., 2003/03/19
- Re: Wierd Warning,
Chris B. Vetter <=