I\'m wondering if there is a reason between two exec functions differing in const
-ness, of if this is just a bug in the Single Unix Spec:
Excerpting fro
To quote the page you link:
The statement about
argv[]
andenvp[]
being constants is included to make explicit to future writers of language bindings that these objects are completely constant. Due to a limitation of the ISO C standard, it is not possible to state that idea in standard C. Specifying two levels ofconst
- qualification for theargv[]
andenvp[]
parameters for the exec functions may seem to be the natural choice, given that these functions do not modify either the array of pointers or the characters to which the function points, but this would disallow existing correct code.
Basically the const
qualification on execlp
and execvp
are completely compatible in the sense that they specify identical limitations on the corresponding arguments.