One year of Coverity work
One year of Coverity work
Posted Aug 22, 2014 20:46 UTC (Fri) by etienne (guest, #25256)In reply to: One year of Coverity work by giraffedata
Parent article: One year of Coverity work
Self initialized variables are surely harder to read - but that is the point: for someone trying to understand (and maybe modify) the source code, that trick tell them to double check everything about its use.
It is obviouly a error to use the value of a self-initialized variable, maybe one day the compiler will flag an error in such case, either at compile time or at run time.
What I need in the algorithm is a "poisonous" value (doesn't exists in C) or a memory area reservation but no visibility at that level (and in the stack, doesn't exists in C).
Myself, if I have a quick bug to correct and I see the obvious test to modify, I will do the change quite quickly; if I see a self initialised variable I will look for the design pattern I was talking of.
It is obviouly a error to use the value of a self-initialized variable, maybe one day the compiler will flag an error in such case, either at compile time or at run time.
What I need in the algorithm is a "poisonous" value (doesn't exists in C) or a memory area reservation but no visibility at that level (and in the stack, doesn't exists in C).
Myself, if I have a quick bug to correct and I see the obvious test to modify, I will do the change quite quickly; if I see a self initialised variable I will look for the design pattern I was talking of.
