[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: auto QString(Builder) considered VERY HARMFUL
From:       Elvis Angelaccio <elvis.angelaccio () kde ! org>
Date:       2018-09-27 19:30:30
Message-ID: af843d3f-c0c6-425e-80bd-7e169e43b540 () kde ! org
[Download RAW message or body]

On giovedì 27 settembre 2018 20:08:54 CEST, Andreas Hartmetz wrote:
> Hello,
>
> Today I fixed the third or so crash in KDE software due to the following 
> pattern:
>
> const auto str = someString + anotherString;
>
> What happens is that the type of str ends up being QStringBuilder 
> instead of QString. The QStringBuilder is destroyed after the semicolon, 
> and all access to "str" produces undefined behavior.
> While I'm not a particularly big fan of using auto to hide variable 
> types anyway, this kind of usage is just wrong and must be avoided. 
> Please take care.

Hi,

is it possible to fix Qt instead?

>
> Cheers,
> Andreas
>

Cheers,
Elvis

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic