Review Request 127061: duchain: builder: display offsets in bytes

Kevin Funk kfunk at kde.org
Mon Feb 15 13:24:05 UTC 2016



> On Feb. 14, 2016, 8:07 p.m., Kevin Funk wrote:
> > What about:
> > 
> > ```
> > struct S
> > {
> >     int a : 1;
> >     int b : 1; // offset is 1 Bit
> > };
> > ```
> 
> Alexandre Courbot wrote:
>     That should translate to 0:1 Bytes. We can test for all the possible cases (bits only, bytes only, bits and bytes) and output a different string each time. I did not think this was worth the added code complexity, but am open to reconsider.
> 
> Milian Wolff wrote:
>     0:1 Bytes is not really understandable to me. So actually, I'd say lets go for the verbose variant:
>     
>         const auto byteOffset = offset / 8;
>         const auto bitOffset = offset % 8;
>         const QString byteOffsetStr = (byteOffset || !bitOffset) ? i18np("1 Byte", "%1 Bytes", byteOffset) : QString();
>         const QString bitOffsetStr = bitOffset ? i18np("1 Bit", "%1 Bits", bitOffset) : QString();
>         QString offset = bitOffset ? i18nc("%1: bytes, %2: bits", "%1, %2", byteOffsetStr, bitOffsetStr) : byteOffsetStr;
>     
>     untested!

+1 for verbose


- Kevin


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/127061/#review92356
-----------------------------------------------------------


On Feb. 13, 2016, 6:25 a.m., Alexandre Courbot wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/127061/
> -----------------------------------------------------------
> 
> (Updated Feb. 13, 2016, 6:25 a.m.)
> 
> 
> Review request for KDevelop.
> 
> 
> Repository: kdevelop
> 
> 
> Description
> -------
> 
> Having the offsets of members in a structure displayed is extremely
> useful for people who work with data structures. However the unit
> chosen (bits) is not really common. This patch changes it to bytes. If
> an offset doesn't round to a byte position, the extra bits are also
> displayed.
> 
> 
> Diffs
> -----
> 
>   languages/clang/duchain/builder.cpp 22d00f0fbbbcbce2eab92df2d9ed2b33e237a9e2 
> 
> Diff: https://git.reviewboard.kde.org/r/127061/diff/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Alexandre Courbot
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20160215/d24ecccb/attachment-0001.html>


More information about the KDevelop-devel mailing list