T O P I C R E V I E W |
TheWisp |
Posted - Apr 20 2017 : 05:25:26 AM Hi, I wonder if it is possible to display size / align / offset of certain class or member. The system programming aspect of C++ is often sensitive about these information, but there is no good way except for putting static asserts all over places. |
7 L A T E S T R E P L I E S (Newest First) |
feline |
Posted - May 03 2017 : 09:38:58 AM Apologies for the delay in getting back to you about this. This makes sense, and I can understand how this would be helpful as you are working, so I have put in a feature request, to see what our developers make of this:
case=105973 |
TheWisp |
Posted - Apr 20 2017 : 3:39:21 PM quote: Originally posted by holedigger
Where would you like this information to be displayed? I can imagine a few options:
- In a new tool window - VA View tool window - Navigation bar - VS Properties tool window - QuickInfo tooltip
If it can be updated fast enough (within seconds), the tooltip would be the best place.
Edit: if updating takes significant time, I still think the tooltip would be the only place, even replacing the result with "calculating..." is way better than making another window / shortcut.
Edit2: it seems possible to do this:
|
holedigger |
Posted - Apr 20 2017 : 3:13:27 PM Where would you like this information to be displayed? I can imagine a few options: - In a new tool window - VA View tool window - Navigation bar - VS Properties tool window - QuickInfo tooltip
|
TheWisp |
Posted - Apr 20 2017 : 2:53:52 PM quote: Originally posted by feline
What concerns me is how accurate and reliable this needs to be. Some users work on cross platform code, so, for example, what happens when on a 32bit system a pointer is a different size to a pointer on a 64bit system? We are only going to be giving you one set of sizes.
I am assuming that the basic types are of fixed size even across systems and compilers, hopefully a broadly reasonable assumption.
However, if a "good guess" is good enough, then it is an interesting idea.
Since we are talking about visual studio here, it would be good enough to match the current config / platform, similar to how intellisense would discover error if I write a static assert about the size. |
feline |
Posted - Apr 20 2017 : 1:21:44 PM What concerns me is how accurate and reliable this needs to be. Some users work on cross platform code, so, for example, what happens when on a 32bit system a pointer is a different size to a pointer on a 64bit system? We are only going to be giving you one set of sizes.
I am assuming that the basic types are of fixed size even across systems and compilers, hopefully a broadly reasonable assumption.
However, if a "good guess" is good enough, then it is an interesting idea. |
TheWisp |
Posted - Apr 20 2017 : 11:38:29 AM I don't know how exactly VA parses the code, but if it can utilize clang for static analysis, wouldn't it cover the size information? |
feline |
Posted - Apr 20 2017 : 10:11:46 AM Do you mean the amount of memory that will be used by the types in a structure / class? I think this is what you are talking about.
If so, then this isn't really something we could try and do in VA, certainly not reliably. It will depend on the compiler, and compiler settings, since this can effect the sizes of the types. I am assuming that basically an "educated but possibly wrong" guess isn't going to be massively helpful here. |