This topic explains how to panic on an illegal value.
This simple example of the use of __ASSERT_ALWAYS shows how to panic on an illegal value.
Suppose the member function F() in class CMyClass, takes a TInt argument which must always be zero or positive.
void CMyClass::F(TInt aValue) { _LIT(KMyPanicDescriptor, "My panic text"); __ASSERT_ALWAYS(aValue >= 0,User::Panic(KMyPanicDescriptor, aValue)); ... /* main body of the function */ ... }
If the caller passes a value which is negative, the current thread is panicked.
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.