[Development] Oslo, we have a problem</apollo 13> [char8_t]

Kevin Funk kevin.funk at kdab.com
Mon Jul 8 10:20:56 CEST 2019


On Monday, 8 July 2019 09:37:24 CEST Allan Sandfeld Jensen wrote:
> On Samstag, 6. Juli 2019 16:53:13 CEST Mutz, Marc via Development wrote:
> > On 2019-07-06 16:38, Konstantin Tokarev wrote:
> > > 06.07.2019, 17:20, "Mutz, Marc via Development"
> > > 
> > > <development at qt-project.org>:
> > >> On 2019-07-06 14:50, Fabian Kosmale wrote:
> > >> [...]
> > >> 
> > >>>   See https://godbolt.org/z/e6OinY for how this would look for a
> > >>>  
> > >>>  trivial function.
> > >> 
> > >> [...]
> > >> 
> > >> Now also handle test(NULL) and extend to binary:
> > >>     test2([0, NULL, nullptr, "", u8""], [0, NULL, nullptr, "", u8""])
> > >> 
> > >> This doesn't scale...
> > > 
> > > It can be argued that use of NULL in C++ code is more relict thing and
> > > should not be
> > > supported. It's also much easier to migrate code base from NULL to
> > > nullptr - simple text
> > > replacement is enough.
> > 
> > 0 -> nullptr is just as simple: clang-tidy has a fixit for that.
> 
> Won't work on Qt code. At least no nicely. When I tried cleaning up QtCore I
> found we do something ugly with QFlags where passing a 0 somehow goes over
> pointer. The fix for
> QFlags<Foo> a(0)
> is
> QFlags<Foo> a = {}
> 
> or we need to update our hack to not trigger the 0 as pointer constant
> warning.

Sorry for derailing more from the original topic:

But for this case another option would be to extend this particular clang-tidy 
checker to support special replacement rules for certain types. It's 
relatively easy to make clang-tidy checkers configurable.

So in this case one would instruct clang-tidy to replace the arg to the 
constructor call `QFlags<T>(...)` with a '{}' instead of a 'nullptr'.

PS: For others wondering about the details about the "QFlags-hack" accepting 
"0", here are all the details:
  https://phabricator.kde.org/D3987

Regards,
Kevin

> 'Allan
> 
> 
> 
> _______________________________________________
> Development mailing list
> Development at qt-project.org
> https://lists.qt-project.org/listinfo/development


-- 
Kevin Funk | kevin.funk at kdab.com | Senior Software Engineer
KDAB (Deutschland) GmbH, a KDAB Group company
Tel: +49-30-521325470
KDAB - The Qt, C++ and OpenGL Experts
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5322 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/development/attachments/20190708/ad4549d6/attachment.bin>


More information about the Development mailing list