Skip to content

Commit 23c58db

Browse files
committed
COMP: Suppress unused variable warning
This example code is useful for representing how to use the code, even though the variable set is not used. Suppress the unused variable warning.
1 parent 112e57e commit 23c58db

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/Core/Common/ReturnObjectFromFunction/Code.cxx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ main()
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;
@@ -67,6 +68,7 @@ main()
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;

src/Core/Mesh/AccessDataInCells/Code.cxx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff 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
}

0 commit comments

Comments
 (0)