Hi!

Tim wrote:
> On Sun, May 26, 2013 at 08:13:58PM +0200, Kurt Jaeger wrote:
> > https://rt.cpan.org/Ticket/Display.html?id=84285
> 
>     error: invalid conversion from 'const char*' to 'char*'
> 
> I'm surprised the compiler treats this as an error, it's normally a warning.

> -        char *plural = (DBIc_ACTIVE_KIDS(imp_dbh)==1) ? "" : "s";
> +        char *plural = (DBIc_ACTIVE_KIDS(imp_dbh)==1) ? (char*)"" : 
> (char*)"s";

clang++ is more strict 8-}

> > Can someone have a look at it ? Is that patch the right way to do it ?
> 
> It would be better to put the const on the declaration in this case.  I.e.:
> 
> -        char *plural = (DBIc_ACTIVE_KIDS(imp_dbh)==1) ? "" : "s";
> +        const char *plural = (DBIc_ACTIVE_KIDS(imp_dbh)==1) ? "" : "s";
> 
> but that may trigger other errors/warnings in later code which will need
> attending to. (Same goes for the other hunk in the patch.)
> 
> Could you give that a go?

Have you seen my second attempt ? It's going along the clang line
and seems much cleaner.

-- 
p...@opsec.eu            +49 171 3101372                         7 years to go !

Reply via email to