[program_options] compile error in libs/program_options/src/convert.cpp

I get the following error while compiling libs/program_options/src/convert.cpp. libs/program_options/src/convert.cpp:100: instantiated from here libs/program_options/src/convert.cpp:48: warning: missing braces around initializer for 'int [6]' Line 48 is: std::mbstate_t state = {0}; The problem is simple but wasn't immediately obvious. The definition of mbstate_t from the cwchar header is: typedef struct { int __fill[6]; } mbstate_t; The int[6] in the error message is actually coming from the first element in mbstate_t. A change that makes the error go away is: std::mbstate_t state = {{0}}; Since I found cwchar in the include/c++/4.1.1 directory the layout of this structure probably isn't guaranteed to be the same across compilers or compiler versions. Perhaps the following would be better: std::mbstate_t state; memset( &state, 0, sizeof(state) ); Has anybody noticed whether this structure has the same definition across compilers? (i.e. gcc, VC, SunCC, etc) -glenn
participants (1)
-
Glenn Schrader