This isn't anything to worry about is it?Code:Assert( uAddress < VMM_MEM, "AddProperty: Invalid address" );
Printable View
This isn't anything to worry about is it?Code:Assert( uAddress < VMM_MEM, "AddProperty: Invalid address" );
It might be. What's the context, and the exact compiler warning?
Context might be helpful -- like the declaration of Assert, the type of uAddress, the value of VMM_MEM.
As in:
Assert is defined as:Code:void VMMemory::Write( unsigned uAddress, DWORD dwVal )
{
Assert( uAddress < VMM_MEM, "Invalid address for VM memory write" );
*( m_dwMemory + uAddress ) = dwVal;
}
AssertDialog is your bog standard Win32 Dialog launcher (DialogBox()) and also takes care of some other stuff.Code:// I pass false or true to AssertDialog here instead of bExpr to avoid a 4800 warning
// This should improve performance too, judging by the actual warning message
#define Assert( bExpr, szErrText ) ( !bExpr ) ? AssertDialog( false, ##szErrText ) : AssertDialog( true, "" );
Code:void AssertDialog( bool bEval, const char* szExprText );
Lacking parentheses, can you take a guess at the expansion? Hint:Quote:
Originally Posted by ahluka
And I doubt you want to have the habit of terminating a macro with a semicolon.Code:!uAddress < VMM_MEM
Yay fixed it - the warning at least.
You meant this right?
Code:#define Assert( bExpr, szErrText ) ( !(bExpr) ) ? AssertDialog( false, ##szErrText ) : AssertDialog( true, "" );
I'd remove the trailing semicolon, and why are you using ##?
[edit]What would be wrong with this?
Code:void Write( unsigned uAddress, DWORD dwVal )
{
AssertDialog( uAddress >= VMM_MEM, "Invalid address for VM memory write" );
// ...
}
Absolutely nothing at all. T'is a good idea - thankies :)
Plus it removes the ambiguation between the standard library Assert macro - my IDE displays two when I type the opening parenthesis. Not a problem, just annoying.