|
[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Re: Refreshed genx.h, plus some plans
On Sun, 25 Jan 2004 16:01:36 +0000, Daniel James
<daniel.james@m...> wrote:
>On Sat, 24 Jan 2004 23:23:06 -0800, Jeremy H. Griffith wrote:
>
>> char *strrchr( const char *string, int c );
>
>The const in strrchr (and strchar, strstr, strpbrk etc.) isn't too great:
>
>#include <stdio.h>
>
>int main()
>{
> const char text[] = "Foo";
> *strrchr(text, 'F') = 'B';
> puts(text);
>}
>
>Although that doesn't stop const being useful, just points out a
>problem with the C standard library.
I don't mean to beat this dead horse into the ground, but there
would only be a problem there if you had:
const char *strrchr( const char *string, int c );
But you don't; the return value is *not* const, and that's what
you are using in your assignment. Granted, the return is an
alias for a string declared as const, but to me this is simple
pilot error, nothing wrong with the aircraft... ;-)
-- Jeremy H. Griffith, at Omni Systems Inc.
(jeremy@o...) http://www.omsys.com/
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|
|||||||||

Cart








