[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Re: Refreshed genx.h, plus some plans


genx omni
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!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.