Closed gudenau closed 6 years ago
This is mainly a bogus warning. You can ignore it.
Of course there's going to be padding applied.
Use /W4
instead of /Wall
when compiling maybe.
I can't do that with this, that's not my change to make. How would I fix it in a cross platform way I could disable this specific warning for this specific structure?
Is that valid on GCC?
No. That's an MSVC warning and pragmas are by definition compiler specific.
So how do you fix this in a way where the same header works on VS and GCC?
Add 7 bytes of padding explicitly.
But seriously, this is not a problem. If the rest of your code base compiles cleanly with /Wall
I'm extremely surprised.
It does, all warnings are treated as errors and if there's a warning they get fixed to help guarantee defined and repeatable behavior across 32/64 bit Linux, Windows and Mac.
My personal projects also use Wall and treat warnings as errors.
You can't even include standard system headers with all warnings enabled. I can't imagine considering the lengths you go to to make this happen time well spent. Also, if you do this, you must be working around C4820 constantly, I don't know why you'd need to ask about it.
Well, I did not make most of the code of this particular project and -Wall
does not mess up GCC so I dunno.
-Wall for GCC is not equivalent to /Wall in MSVC. Compiler warnings are unsurprisingly compiler specific. The "sane" level of warnings for MSVC is /W4, not /Wall. This is more inline with -Wall for GCC.
The stdlib for MSVC doesn't even compile cleanly with /Wall nor is it a goal for their team because /Wall produces way too much noise, like the one you encountered.
When compiling a project with
discord-rpc.h
included and compiled with Visual Studio's compiler generates a warning about padding. The structureDiscordRichPresence
has a warning about padding added after the memberinstance
.Warning:
discord-rpc.h(42): warning C4820: 'DiscordRichPresence': '7' bytes padding added after data member 'instance'
Please note, I have manually applied #100 to the header file.