Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
User name:
Password:
Save Password
Forgot your password?

 All Forums
 Visual Assist
 Feature Requests
 sizeof / alignof / offsetof symbol display
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

TheWisp
New Member

5 Posts

Posted - Apr 20 2017 :  05:25:26 AM  Show Profile  Reply with Quote
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.

Edited by - TheWisp on Apr 20 2017 05:27:30 AM

feline
Whole Tomato Software

United Kingdom
14608 Posts

Posted - Apr 20 2017 :  10:11:46 AM  Show Profile  Reply with Quote
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.

zen is the art of being at one with the two'ness
Go to Top of Page

TheWisp
New Member

5 Posts

Posted - Apr 20 2017 :  11:38:29 AM  Show Profile  Reply with Quote
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?
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
14608 Posts

Posted - Apr 20 2017 :  1:21:44 PM  Show Profile  Reply with Quote
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.

zen is the art of being at one with the two'ness
Go to Top of Page

TheWisp
New Member

5 Posts

Posted - Apr 20 2017 :  2:53:52 PM  Show Profile  Reply with Quote
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.
Go to Top of Page

holedigger
Whole Tomato Software

127 Posts

Posted - Apr 20 2017 :  3:13:27 PM  Show Profile  Visit holedigger's Homepage  Reply with Quote
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

Whole Tomato Software
Go to Top of Page

TheWisp
New Member

5 Posts

Posted - Apr 20 2017 :  3:39:21 PM  Show Profile  Reply with Quote
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:

Edited by - TheWisp on Apr 20 2017 3:58:16 PM
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2017 Whole Tomato Software, Inc Go To Top Of Page
Snitz Forums 2000