0

How can I know how all members of the structure are located inside? I need detailed listing with all the offsets and sizes Is there's any plugin for IDE, I use Visual Studio 2013? I can't use offset of or something similar because I need information about all the fields

struct Test {
  int   a; //0x0000 (4)
  float b; //0x0004 (4)
  bool  c; //0x0008 (1)
}; //Size=0x000C

Thank you

Annett
  • 75
  • 1
  • 7
  • Your reason for not being able to use `offsetof` is odd. You can't find out anything about the members without naming them individually, if that's what you're after. Visual Studio may have an extension API that lets you get to the names, but whether you can find out offsets that way is another matter. – molbdnilo Aug 27 '17 at 16:56
  • It isn't odd. I have a 30mb of auto-generated classes, somewhere error in algnment, I need to find it and I'm not able to check all this code using offsetof and running it all the time? I need a tool for it, which shows how members located inside all the structures - I need something to show me how compiler thinks – Annett Aug 27 '17 at 17:00

1 Answers1

0

There is no built-in reflection regarding structs. There are libraries which introduce more code (usually a macro), which make the struct reflectable.

Examples:

If you can change your auto-generated code to include some of this, you might have some luck. Otherwise, I don't think there is a way.

Josh
  • 12,602
  • 2
  • 41
  • 47