Monday, November 07, 2005

always use memset on the structures

never leave a structure with unfilled values, for example:


in order to avoid this, a good practice would be one of these:

- remember to always initialize members we don't need:
bi.hwndOwner = NULL;

- just initialize the variabile:
BROWSEINFO bi = { 0 };

- use memset on the structure:
memset(bi, 0, sizeof(BRWOSEINFO));

No comments: