Re: C++ Issue with const char * on strchr

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jochen Schmitt wrote:
> Conrad Meyer schrieb:
>> const char *str1, str2; str2 = strchr(str1, 'a');
> 
>> But str2 must be a const char *.
> 
>> Maybe I am wrong, I am not very familiar with C++.
> 
>> Regards, My understanding is you can do something like this:
> 
> I am doing something like this
> 
> char *str2;
> const char *str1;
> 
> str2 = strchr(str1, 'a');    // This fails on gcc-4.4
> 
> When I write
> 
> char *str2;
> const char *str1;
> char *temp = const_cast<char *>(str1);
> 
> str2 = strchr(temp,'a')   // This works
> 
> Because this issue occurs only on gcc-4.4, I want to ask: is this
> a bug or a feature?

It's a feature.

Andrew.

-- 
fedora-devel-list mailing list
fedora-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/fedora-devel-list

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]
  Powered by Linux