On 04.07.2014 04:34, Ben Reser wrote: > On 7/3/14 4:50 PM, Gabriela Gibson wrote:> it compiles and runs and in gdb the > vars do change, but the compiler isn't happy: >> subversion/svn/svn.c: In function 'main': >> >> subversion/svn/svn.c:3048:23: warning: assignment discards 'const' qualifier >> from pointer target type [enable\ >> d by default] >> >> argv[i-1] = "#####\0"; >> >> ^ >> >> subversion/svn/svn.c:3052:23: warning: assignment discards 'const' qualifier >> from pointer target type [enable\ >> d by default] >> >> argv[i-1] = "#####\0"; > The main function has the const qualifier on argv. You either need to remove > that or cast it away.
Um. Let's try explaining that again. The standard signature for main() is: int main(int argc, char* argv[]); where nothing is constant. However, very often, programs use this essentially equivalent form: int main(int argc, const char* argv[]); This is the signature we use. However: in this case, argv is *not* const, it only points to const strings. What's happening in your case, Gabriela, is that youre using the "char* argv[]" signature without the "const"; and assigning constant string pointers to it. A C string literal (in C99; not in C90) has the type "const char*", hence the warning, since you're assigning it to a "char*". However: what you're doing here is changing the pointers in the argv array. Your're *not* changing the (presumably original) argument string that those pointers refer to. So it's not surprising that the kernel, and hence ps, doesn't notice the change. -- Brane -- Branko Čibej | Director of Subversion WANdisco // Non-Stop Data e. br...@wandisco.com