[TEST REQUEST] Windows Bluetooth LE build

Berthold Stoeger bstoeger at mail.tuwien.ac.at
Mon Jun 11 13:21:11 PDT 2018


On Montag, 11. Juni 2018 20:50:56 CEST Linus Torvalds wrote:

> BLE is kind of odd. We also do things kind of oddly, because the way
> we generate that 16-bit value is with
> 
>     QByteArray::fromHex("0100")

I think the idiomatic way to do this is the
   QByteArrayLiteral("\x01\x00")
macro invocation (don't look at the macro definition - you might weep). Here, 
the object is compile-time generated. Nevertheless, its use is not "free" as 
claimed in the docs. There's still useless code generated owing to reference 
counting. Well, perhaps the compiler could decide that deallocating the static 
storage is undefined behavior and simply not generate the deallocation branch. 
But "gcc -O2" does.

TL;DR: writeCharacteristic() taking a "const QByteArray &" parameter is an 
API-bug. It should take an "array_view" (i.e. const pointer + length) to which 
QByteArray automatically converts.

Berthold




More information about the subsurface mailing list