Hi Tony, On 8/16/07, Tony Mechelynck <[EMAIL PROTECTED]> wrote: > > Chris Sutcliffe wrote: > > Replied direct to Bram instead of the list... > > > > On 8/15/07, Chris Sutcliffe wrote: > >>> Adding (char *) casts for things that are already character strings? > >>> Isn't this a problem in gcc? > >> GCC complains that const char*'s is being passed as a char*'s (because > >> it's a contant string being passed in the quotes), so I re-cast it as > >> a (char*) to get rid of the warnings. > >> > >> Basically because, for example, searchpath(char *) is defined to take > >> a char* argument and "gvim.bat" is considered a constant char*, there > >> is a mismatch in argument types (which GCC 4 is a little more adamant > >> about, since I believe one of GCC 4's goals is to be more standards > >> compliant). > >> > >> Cheers! > >> > >> Chris > >> > >> -- > >> Chris Sutcliffe > >> http://ir0nh34d.googlepages.com > >> http://ir0nh34d.blogspot.com > >> http://emergedesktop.org > >> > > > > > > shouldn't the function take const char * as arguments instead? Meaning it > doesn't modify that argument even though it's a pointer.
Yes, I think so. Const-correctness is always a big problem. The old version of C without ++ doesn't support "const". So many C progammers are not familiar with the const keyword. Any way, it seems that you also misunderstood the const keyword. "const char *" means "a pointer points to const char", so you are not able to modify the pointed content, but the pointer itself is still modifiable. For example, you could say: const char *p; ... ++p; > > > Best regards, > Tony. > -- > A special cleaning ordinance bans housewives from hiding dirt and dust under a > rug in a dwelling. > [real standing law in Pennsylvania, United States of America] > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message from the "vim_dev" maillist. For more information, visit http://www.vim.org/maillist.php -~----------~----~----~----~------~----~------~--~---