Richard said:
Bill Pursell said:
Richard Heathfield wrote:
For each argv[n] where n >= 0 && n < argc, you can write to the
characters starting with argv[n][0] and going no further than the null
terminator.
Which is clear if you prototype main as int main(int argc, char
*const*argv),
plus you'll get a compiler warning if you try to write the values.
That's fine, provided your implementation documents that form for main().
Otherwise, ISTM that you are invoking undefined behaviour.
I didn't realize that. For a while, I've been thinking that I would
stop writing main functions completely and spend the time
figuring out the python interface so I can write my processing
in C and do all the argument parsing and process manipulation
in python, and this fact is a tick in the column in favor of doing
that.
But, it doesn't seem like it's worth the effort. The ability to
manipulate
strings easily is hardly worth the work it would take to get the
interface
right.