Added explanatory comments. Replaced tabs with spaces.
git-svn-id: svn://svn.code.sf.net/p/loki-lib/code/trunk@1154 7ec92016-0320-0410-acc4-a06ded1c099a
This commit is contained in:
parent
ac16c24fb5
commit
efe104663e
1 changed files with 8 additions and 5 deletions
|
@ -135,6 +135,7 @@ int main( int argc, const char * argv[] )
|
||||||
// Should not assert since caller stores return value ...
|
// Should not assert since caller stores return value ...
|
||||||
BoolReturn checkBool = CheckRequired();
|
BoolReturn checkBool = CheckRequired();
|
||||||
// and then deliberately ignores it before destructor runs.
|
// and then deliberately ignores it before destructor runs.
|
||||||
|
// Ignore any compiler warnings that says code does not check return value.
|
||||||
(bool)checkBool;
|
(bool)checkBool;
|
||||||
cout << "Called CheckRequired, stored return value, and ignored it."
|
cout << "Called CheckRequired, stored return value, and ignored it."
|
||||||
<< endl;
|
<< endl;
|
||||||
|
@ -143,26 +144,28 @@ int main( int argc, const char * argv[] )
|
||||||
{
|
{
|
||||||
// This should not assert since caller deliberately chooses to not
|
// This should not assert since caller deliberately chooses to not
|
||||||
// check return value by casting to return value to correct type.
|
// check return value by casting to return value to correct type.
|
||||||
|
// Ignore any compiler warnings that says code does not check return value.
|
||||||
(bool)CheckRequired();
|
(bool)CheckRequired();
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
// This should not assert since caller deliberately chooses to not
|
// This should not assert since caller deliberately chooses to not
|
||||||
// check return value by casting to return value to correct type.
|
// check return value by casting to return value to correct type.
|
||||||
|
// Ignore any compiler warnings that says code does not check return value.
|
||||||
(bool)CheckRequired( false );
|
(bool)CheckRequired( false );
|
||||||
cout << "Made a nested call to CheckRequired." << endl;
|
cout << "Made a nested call to CheckRequired." << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
BoolReturnStderr check = CheckRequiredStderr();
|
BoolReturnStderr check = CheckRequiredStderr();
|
||||||
}
|
}
|
||||||
cout << "There should be a error message: \nCheckReturn: return value was not checked" << endl;
|
cout << "There should be a error message: \nCheckReturn: return value was not checked" << endl;
|
||||||
|
|
||||||
// This should assert since caller does not check return value.
|
// This should assert since caller does not check return value.
|
||||||
CheckRequired();
|
CheckRequired();
|
||||||
cout << "Should assert before this line! How did we get here?" << endl;
|
cout << "Should assert before this line! How did we get here?" << endl;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue