On 2026-01-14 02:48, Bruno Haible wrote:
I would argue that the original code was correct: None of the exec* and posix_spawn* functions writes into the argv[] strings.
Although that's true in practice, in theory a conforming implementation of posix_spawn (..., argv, ...) could start with the statement "if (argv[0]) argv[0][0] = argv[0][0];", which means that in theory one cannot put a string literal into argv[i]. Although the rationale for exec* argues against such an implementation, the rationale is not binding even on exec*.
Admittedly this is just language-lawyering and yes, the original code is correct on all practical systems. I merely tired of the warning, and didn't want to use casts to pacify GCC.
