Symbian3/SDK/Source/GUID-255B6815-8CC8-5E4A-9999-9BC083BCCD83.dita
author Graeme Price <GRAEME.PRICE@NOKIA.COM>
Fri, 15 Oct 2010 14:32:18 +0100
changeset 15 307f4279f433
parent 0 89d6a7a84779
permissions -rw-r--r--
Initial contribution of the Adaptation Documentation.

<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
<!-- This component and the accompanying materials are made available under the terms of the License 
"Eclipse Public License v1.0" which accompanies this distribution, 
and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
<!-- Initial Contributors:
    Nokia Corporation - initial contribution.
Contributors: 
-->
<!DOCTYPE concept
  PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
<concept id="GUID-255B6815-8CC8-5E4A-9999-9BC083BCCD83" xml:lang="en"><title>Using
__ASSERT_ALWAYS</title><shortdesc>This topic explains how to panic on an illegal value.</shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody>
<p>This simple example of the use of <codeph>__ASSERT_ALWAYS</codeph> shows
how to panic on an illegal value. </p>
<p>Suppose the member function <codeph>F()</codeph> in class <codeph>CMyClass</codeph>,
takes a <codeph>TInt</codeph> argument which must always be zero or positive. </p>
<codeblock id="GUID-21213FE1-90B2-5218-BD0C-E2D598962AD6" xml:space="preserve">void CMyClass::F(TInt aValue)
 {
 _LIT(KMyPanicDescriptor, "My panic text");

 __ASSERT_ALWAYS(aValue &gt;= 0,User::Panic(KMyPanicDescriptor, aValue));
 ...
 /* main body of the function */
 ...
 }</codeblock>
<p>If the caller passes a value which is negative, the current thread is panicked. </p>
</conbody></concept>