- goto compiler explorer www.godbolt.org
- select the latest available msvc compiler of ur desired bitness
- paste ur whole struct definition or include the header that contains it(if its a windows/c/c++ standard one)
- add the compiler switch /d1reportSingleClassLayoutname_of_ur_struct_here
- check the compiler output logs
Code: Select all
example.cpp class _devicemodeW size(220): +--- 0 | dmDeviceName 64 | dmSpecVersion 66 | dmDriverVersion 68 | dmSize 70 | dmDriverExtra 72 | dmFields 76 | dmOrientation 78 | dmPaperSize 80 | dmPaperLength 82 | dmPaperWidth 84 | dmScale 86 | dmCopies 88 | dmDefaultSource 90 | dmPrintQuality 76 | _POINTL dmPosition 84 | dmDisplayOrientation 88 | dmDisplayFixedOutput 92 | dmColor 94 | dmDuplex 96 | dmYResolution 98 | dmTTOption 100 | dmCollate 102 | dmFormName 166 | dmLogPixels 168 | dmBitsPerPel 172 | dmPelsWidth 176 | dmPelsHeight 180 | dmDisplayFlags 180 | dmNup 184 | dmDisplayFrequency 188 | dmICMMethod 192 | dmICMIntent 196 | dmMediaType 200 | dmDitherType 204 | dmReserved1 208 | dmReserved2 212 | dmPanningWidth 216 | dmPanningHeight +--- Compiler returned: 0
cons: doesnt fare too well with byvalue included nested structs, so ull have to crunch some numbers in ur head. also, cant use aliased struct names, need to specify the true name(alternatively, dump everything with /d1reportAllClassLayout and ctrl+f the name of some field and ull probably find it, but it takes longer for the output to be generated so it may timeout)