I am creating some kind of interface for the program. To run the program, I use the CreateProcess() call, which, among other things, gets a pointer to the STARTUPINFO structure. To initialize the structure that I used:
STARTUPINFO startupInfo = {0}; // Or even '\0'. startupInfo.cb = sizeof(startupInfo);
When compiling a program with GCC enabled with these warning sets -Wall -Wextra this gives me a warning that there is no initializer pointing to the first line.
warning: missing initializer warning: (near initialization for 'startupInfo.lpReserved')
So I finished:
STARTUPINFO startupInfo; memset(&startupInfo, 0, sizeof(startupInfo)); startupInfo.cb = sizeof(startupInfo);
And thus the compiler does not give any warnings. The question is, what is the difference between these methods of initializing the structure? Using the first method, is the structure initialized? Which one would you recommend?
c gcc winapi
Shantia Oct 08 '09 at 16:26 2009-10-08 16:26
source share