Hi everyone,
I would like to use Cppcheck to check if all the local union variable in my legacy projects are initialized, so that there won't be any garbage value in their memory address.
Please refer to the demo code below. After running Cppcheck, there's no further error or warning in the line where I left a uninitialized, union type local variable on purpose. It seems that Cppcheck only shows the MISRA-C style warning "The union keyword should not be used" in the code section.
Is it possiable to do such an analysis by using Cppcheck? Please give me some hints.
Thanks for your time!
(Cppcheck version : 2.10)
Hi everyone,
I would like to use Cppcheck to check if all the local union variable in my legacy projects are initialized, so that there won't be any garbage value in their memory address.
Please refer to the demo code below. After running Cppcheck, there's no further error or warning in the line where I left a uninitialized, union type local variable on purpose. It seems that Cppcheck only shows the MISRA-C style warning "The union keyword should not be used" in the code section.
Is it possiable to do such an analysis by using Cppcheck? Please give me some hints.
Thanks for your time!
It seems that we bail out for unions, see https://trac.cppcheck.net/ticket/8046 and
needsInitialization()
.