On Tue, 2022-01-11 at 10:57 +0000, Edward Welbourne wrote:
> Indeed.  The compiler is allowed to place a string literal in read-
> only memory, where modifying it (even if you do "put it back the way
> it was" later) is an access violation.  Passing such a const char *
> to your function would thus crash.

Of course, I'm very well aware of all of this.

But, in fact, it's not possible for make to pass a string literal to
this function.  So your scenario will never happen.

As I've said in other messages in this thread, the right way to fix
this, if we wanted to fix it, would be to allocate separate memory and
copy the substring into that so that the original string would not be
modified.  It's the WRONG behavior to start de-constifying swaths of
the program to allow a low-level method to modify strings.


Reply via email to