On Wed, 13 Oct 2010 20:09:02 -0700
"Zang Roy-R61911" [off-list ref] wrote:
quoted
quoted
quoted
quoted
+ struct fsl_elbc_fcm_ctrl *elbc_fcm_ctrl = NULL;
No need for = NULL.
Any harm? Or just personal habit or style? Can you explain about
why?
quoted
Besides not wanting superfluous code on general principle, it could
hide a bug if in the future the real initialization is missing on some
code path. It would become a runtime NULL dereference rather than a
compiler warning.
Not exactly.
Per my understand, if the pointer will definitely be assigned in code
path,
it is not necessary to init it when define. for example,
char c;
char b;
char *a;
if (condition)
a = &c;
else
a = &b;
...
for other case, if the path will not ensure the pointer assignment, it
will be inited
when define to avoid warning. for example,
char c;
char *a = NULL;
if (condition)
a = &c;
...
Yes, but this patch looks like the former case, not the
latter. Is GCC giving a warning without the initializer?
-Scott