OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: Refreshed genx.h, plus some plans

[ Lists Home | Date Index | Thread Index ]

On Sat, 24 Jan 2004 23:23:06 -0800, Jeremy H. Griffith wrote:

> Gee, you'd better tell Microsoft!  Their entire C Library for Visual C
> uses const throughout.  <bg>  A few simple examples:
> 
> size_t strlen( const char *string );
> int strcmp( const char *string1, const char *string2 );
> size_t strspn( const char *string1, const char *string2 );
> 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.

Daniel





 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS