[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Invalid use of const pointer?

From: Paul Smith
Subject: Re: Invalid use of const pointer?
Date: Sun, 09 Jan 2022 10:17:10 -0500
User-agent: Evolution 3.36.5-0ubuntu1

On Sun, 2022-01-09 at 11:06 +0100, Henrik Carlqvist wrote:
> On Sat, 08 Jan 2022 17:29:33 -0500 Paul Smith <psmith@gnu.org> wrote:
> > It turns out to be innocuous because none of the callers care that
> > the value of the input string is modified if we return a different
> > string, but it's still wrong and should be fixed.
> If so, the easy and more correct fix might be to to remove const from
> the function variable declarations rather than to restore the value.

It's not that easy.  Removing the const from the argument means that we
have to change all the caller's types to remove const, and that means
all the callers of those methods have to remove const, etc.

In any event, the bug still exists whether you say the argument is
const or not: the expectation when this function is called is that
after it returns the string passed to it has the same content as before
it was called.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]