You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@geode.apache.org by "pivotal-jbarrett (GitHub)" <gi...@apache.org> on 2018/10/08 20:49:35 UTC

[GitHub] [geode-native] pivotal-jbarrett opened pull request #372: GEODE-5770: Fixes clang-analyzer-optin.performance.Padding warning


[ Full content available at: https://github.com/apache/geode-native/pull/372 ]
This message was relayed via gitbox.apache.org for notifications@geode.apache.org

[GitHub] [geode-native] pdxcodemonkey commented on pull request #372: GEODE-5770: Fixes clang-analyzer-optin.performance.Padding warning

Posted by "pdxcodemonkey (GitHub)" <gi...@apache.org>.
What exactly does this do?  It looks like you've swapped around initialization order and perhaps declaration order of a bunch of member variables in several classes.  I'm familiar with having to do this quite often to get rid of compiler warnings when using gcc, but this is Clang and referring to "performance.padding" - does this gripe if you're declaring pointers on unaligned boundaries in your class or something?  I didn't think any modern compilers did this... 

[ Full content available at: https://github.com/apache/geode-native/pull/372 ]
This message was relayed via gitbox.apache.org for notifications@geode.apache.org

[GitHub] [geode-native] pivotal-jbarrett commented on pull request #372: GEODE-5770: Fixes clang-analyzer-optin.performance.Padding warning

Posted by "pivotal-jbarrett (GitHub)" <gi...@apache.org>.
What this is doing is trying to avoid a lot of unnecessary padding that can bloat the size of you objects in memory. The order is important because certain types will have to pad out to fix the alignment types. For example, I can't have an int that starts after a single boolean without padding out at least 3 bytes.

For example:
```C++
bool a;
int b;
bool c;
```
Results in 3 bytes of padding after `a` and 3 bytes after `c` for a total of 6 bytes of padding.

Reordering to:
```C++
bool a;
bool c;
int b;
```
Results in 2 bytes of padding after `c` only.




[ Full content available at: https://github.com/apache/geode-native/pull/372 ]
This message was relayed via gitbox.apache.org for notifications@geode.apache.org

[GitHub] [geode-native] pivotal-jbarrett closed pull request #372: GEODE-5770: Fixes clang-analyzer-optin.performance.Padding warning

Posted by "pivotal-jbarrett (GitHub)" <gi...@apache.org>.
[ pull request closed by pivotal-jbarrett ]

[ Full content available at: https://github.com/apache/geode-native/pull/372 ]
This message was relayed via gitbox.apache.org for notifications@geode.apache.org