0

Today I tried compiling my project using -WALL option, but I got many warnings like 600 but all seemed to come from standard library files e.g

Project Properties -> C/C++ -> General -> Warning Level -> Wall

Warning 14  warning C4820: '_wfinddata64_t' : '4' bytes padding added after data member '_wfinddata64_t::attrib'    c:\program files\microsoft visual studio 11.0\vc\include\wchar.h    118
Warning 15  warning C4820: '_stat32' : '2' bytes padding added after data member '_stat32::st_gid'  c:\program files\microsoft visual studio 11.0\vc\include\wchar.h    507
Warning 16  warning C4820: 'stat' : '2' bytes padding added after data member 'stat::st_gid'    c:\program files\microsoft visual studio 11.0\vc\include\wchar.h    523
Warning 17  warning C4820: '_stat32i64' : '2' bytes padding added after data member '_stat32i64::st_gid'    c:\program files\microsoft visual studio 11.0\vc\include\wchar.h    539
Warning 18  warning C4820: '_stat32i64' : '4' bytes padding added after data member '_stat32i64::st_rdev'   c:\program files\microsoft visual studio 11.0\vc\include\wchar.h    540

is this normal? Why am I getting warnings from other files?

  • Your question should include which compiler (and which version of that compiler) you are using, preferably also with a minimal code sample – M.M Feb 20 '16 at 20:45
  • @M.M Visual Studio 2012. This is class I used: http://www.zedwood.com/article/cpp-sha256-function. and a very basic hello world using this class, e.g. computation of hash –  Feb 20 '16 at 20:51
  • @M.M I remember something similar happened to me the other time too, with different project –  Feb 20 '16 at 20:52
  • 1
    Possible duplicate of [this one](http://stackoverflow.com/q/4001736/5583153) – Nacho Feb 20 '16 at 20:55

1 Answers1

1

Under Visual Studio, /Wall actually generates more warnings than anyone would care about - typically you use it when you are debugging a very obscure problem and need to determine if you are seeing a Visual Studio bug or a very weird edge-case in low-level code.

You should probably use /W3 which are about equivalent to GCC/Clang's -Wall. Or /W4 if you plan to be extremely diligent. /W3 will often show warnings in other peoples' code, /W4 will warn about esoteric things like un-referenced formal parameters but also useful cases like shadowed variables.

kfsone
  • 23,617
  • 2
  • 42
  • 74