[haiku] Re: const char*

  • From: Joseph Prostko <joe.prostko+haiku@xxxxxxxxx>
  • To: haiku@xxxxxxxxxxxxx
  • Date: Wed, 1 Jul 2009 14:03:26 -0400

On Wed, Jul 1, 2009 at 11:55 AM, Travis D. Reed<tdreed@xxxxxxxxx> wrote:
> Here's the relevant compiler output. I'm using gcc (GCC) 4.4.0 20090526
> (prerelease), which is what ArchLinux requires at the
>  moment.

Here is a link describing what's going on:

http://gcc.gnu.org/gcc-4.4/porting_to.html

Scroll down a bit to the "Strict null-terminated sequence utilities"
section, and you'll see how things have changed in the interest of
const-correctness for GCC 4.4.

r30919 was the first instance I saw a fix in this regard,

Basically, with GCC 4.4, if something like strchr is fed a const char*
, it's going to return a const char* .  This can then become
problematic, like has shown to be the case here.

I assume some kind of casting will have to be done.  Will utilizing
const_cast or the like be the way to go?  I'm currently testing other
breakage, so will wait to update my Linux compiler to do further
testing in this regard.

- joe

Other related posts: