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

List:       kde-devel
Subject:    Re: auto QString(Builder) considered VERY HARMFUL
From:       Daniel Nicoletti <dantti12 () gmail ! com>
Date:       2018-09-27 18:54:47
Message-ID: CACo8zOe4So+=39VQyQTT1z=Q7bLyWRSar=RqPfGe7DDvbSQAww () mail ! gmail ! com
[Download RAW message or body]

I would be awesome if clazy detected this :)
Em qui, 27 de set de 2018 Ã s 15:09, Andreas Hartmetz
<ahartmetz@gmail.com> escreveu:
>
> 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.
>
> Cheers,
> Andreas
>
>


-- 
Daniel Nicoletti

KDE Developer - http://dantti.wordpress.com
[prev in list] [next in list] [prev in thread] [next in thread] 

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