I have an error I don't understand with attached cpp file.
new3.cpp:22:14: error: Memory is allocated but not initialized: nc [uninitdata]
delete[] nc;
I don't get two things:
- first why this error (assuming intersection function fills the values of xc, yc, nc)
- second why xc, yc are not seen uninitialized like nc
thanks for reporting. I don't think that we should warn about delete[] nc; even if the nc data is uninitialized. I have created this ticket: https://trac.cppcheck.net/ticket/11132
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
I have an error I don't understand with attached cpp file.
new3.cpp:22:14: error: Memory is allocated but not initialized: nc [uninitdata]
delete[] nc;
I don't get two things:
- first why this error (assuming intersection function fills the values of xc, yc, nc)
- second why xc, yc are not seen uninitialized like nc
Thanks for your help.
command line to reproduce the problem: cppcheck new3.cpp --enable=all
nc
is only used conditionally inside the firstif
block.yc
andyc
are used in two places.thanks for reporting. I don't think that we should warn about
delete[] nc;
even if the nc data is uninitialized. I have created this ticket: https://trac.cppcheck.net/ticket/11132