File tree Expand file tree Collapse file tree 2 files changed +4
-1
lines changed
Common/ReturnObjectFromFunction Expand file tree Collapse file tree 2 files changed +4
-1
lines changed Original file line number Diff line number Diff line change 5959
6060 {
6161 ImageType * pointer = ReturnPointer ();
62+ (void )pointer;
6263 // This crashes the program because the smart pointer created in the function goes out of scope and gets deleted
6364 // because it is returned as a normal pointer.
6465 // std::cout << pointer->GetLargestPossibleRegion() << std::endl;
6768
6869 {
6970 ImageType * pointer = ReturnSmartPointer ();
71+ (void )pointer;
7072 // This crashes the program because though the function returned a ::Pointer, it was not stored
7173 // anywhere so the reference count was not increased, so it got deleted.
7274 // std::cout << pointer->GetLargestPossibleRegion() << std::endl;
Original file line number Diff line number Diff line change @@ -75,7 +75,8 @@ main(int, char *[])
7575
7676 while (cellDataIterator != end)
7777 {
78- PixelType cellValue = cellDataIterator.Value ();
78+ const PixelType cellValue = cellDataIterator.Value ();
79+ (void )cellValue; // Avoid unused variable warning for this example code
7980 // std::cout << cellValue << std::endl; //same values as before
8081 ++cellDataIterator;
8182 }
You can’t perform that action at this time.
0 commit comments