You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Dean Gaudet <dg...@arctic.org> on 1997/07/21 07:06:11 UTC
interesting use of const
>From util.c:
API_EXPORT(void) chdir_file(const char *file) {
int i;
if((i = rind(file,'/')) == -1)
return;
((char *)file)[i] = '\0';
chdir(file);
((char *)file)[i] = '/';
}
Yeah, that's const alright. Not.
I'm working on cleaning up "gcc -Wall -Wshadow -Wpointer-arith -Wcast-qual
-Wcast-align -Wstrict-prototypes -Wnested-externs" output ;) Well,
cleaning up what really needs cleaning. There are some potential
portability and human-error problems that this picks out. I had a few
more -Ws in there, but some of it's really hopeless.
Dean
Re: interesting use of const
Posted by Ben Laurie <be...@algroup.co.uk>.
Dean Gaudet wrote:
> >From util.c:
>
> API_EXPORT(void) chdir_file(const char *file) {
> int i;
>
> if((i = rind(file,'/')) == -1)
> return;
> ((char *)file)[i] = '\0';
> chdir(file);
> ((char *)file)[i] = '/';
> }
>
> Yeah, that's const alright. Not.
Well, the overall effect is const, but...
Cheers,
Ben.
--
Ben Laurie Phone: +44 (181) 994 6435 Email:
ben@algroup.co.uk
Freelance Consultant and Fax: +44 (181) 994 6472
Technical Director URL: http://www.algroup.co.uk/Apache-SSL
A.L. Digital Ltd, Apache Group member (http://www.apache.org)
London, England. Apache-SSL author