httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ben Laurie <>
Subject Re: overloaded functions
Date Fri, 25 Jun 1999 16:25:10 GMT
Dean Gaudet wrote:
> Oh, one thing ages back which I said was nifty in C++:
>     char *strchr(char *, int);
>     const char *strchr(const char *, int);
> That way you don't have to lose the "const" when you use this on a const
> string... this helps detect bugs at compile time.
> But gnu c gives me what I want:
> #ifef __GNUC__
> #define my_strchr(a,b)  ((typeof (a)) strchr((a), (b)))
> #else
> #define my_strchr strchr
> #endif
> ... which is good enough for most of the developers to get the warnings :)

OK. Another one I keep bumping into is this:

	unsigned char *x,*y;

	y=strchr(x,' ');

compiler meeps because x,y should be char *. Yes, we can do ustrchr, but
it gets messy (namewise) when you have three or more char * arguments.

Any clever ideas for that?




"My grandfather once told me that there are two kinds of people: those
who work and those who take the credit. He told me to try to be in the
first group; there was less competition there."
     - Indira Gandhi

View raw message