September 08, 2001
Axel Kittenberger wrote:
> 
> >> What's wrong with strchr()? MSVC's version of it seems to be
> >> declared sanely.
> >
> > *must hold back scarcasm* *must hold back scarcasm*
> 
> Ooops sorry I hit enter too early, I was still in typing the message... so don't take it personally :/
> 
> MSVC's version just as good/bad as every others. Take a look what strchr() takes for an argument and take a look what the return type is.
> 
> So what happened to the 'const'? If I've a 'const char *' so am not allowed to change it, and search for a character with strchr(), it returns: suprise a 'char *' pointer, one that I can use to modify the contents from which was before forbidden.

Got it. Thanks.

-RB
September 09, 2001
Russell Bornschlegel wrote in message <3B990579.49549F81@estarcion.com>...
>Walter wrote:
>>
>> Correct. Const is not part of the typing system, although you will get an error if you try storing directly into a const:
>>
>>     const int foo = 5;
>>     foo = 3;        // error
>>
>> Note that C hardly gets it right. Look at strchr().
>
>What's wrong with strchr()? MSVC's version of it seems to be
>declared sanely.


strchr() implicitly converts a const char * into a char *.


1 2 3
Next ›   Last »