
Dear Prafulla,
In message 73173D32E9439E4ABB5151606C3E19E202E3915996@SC-VEXCH1.marvell.com you wrote:
This fixes some compiler warnings: tools/default_image.c:141: warning: initialization from incompatible pointer type tools/fit_image.c:202: warning: initialization from incompatible pointer type and changes to code to use "const" attributes in a few places where it's appropriate.
99% of the changes in this patch is to add const attributes.
Yes, indeed.
Can you pls explain here- how useful it is to add const.
Well, adding "const" where appropriate is definitely a good thing, as it const augments data-hiding and encapsulation and allows the compiler to check for (and prevent!) unintended modification of data structures, i. e. for programming errors. Also, it helps the compiler for better optimization.
Or do it make more sense just to fix the warnings in respective functions? I have posted a patch for the same
I did not see any patch form you addressing these warnings?
My "const"-adding patch was the more or less direct result of getting rid of the warnings without using additional type casts.
I think using const is a good thing. I am aware that it sometimes becomes painful, and some consider it a waste of time.
Best regards,
Wolfgang Denk