Symbian3/SDK/Source/GUID-255B6815-8CC8-5E4A-9999-9BC083BCCD83.dita
changeset 7 51a74ef9ed63
parent 0 89d6a7a84779
equal deleted inserted replaced
6:43e37759235e 7:51a74ef9ed63
       
     1 <?xml version="1.0" encoding="utf-8"?>
       
     2 <!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
       
     3 <!-- This component and the accompanying materials are made available under the terms of the License 
       
     4 "Eclipse Public License v1.0" which accompanies this distribution, 
       
     5 and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
       
     6 <!-- Initial Contributors:
       
     7     Nokia Corporation - initial contribution.
       
     8 Contributors: 
       
     9 -->
       
    10 <!DOCTYPE concept
       
    11   PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
       
    12 <concept id="GUID-255B6815-8CC8-5E4A-9999-9BC083BCCD83" xml:lang="en"><title>Using
       
    13 __ASSERT_ALWAYS</title><shortdesc>This topic explains how to panic on an illegal value.</shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody>
       
    14 <p>This simple example of the use of <codeph>__ASSERT_ALWAYS</codeph> shows
       
    15 how to panic on an illegal value. </p>
       
    16 <p>Suppose the member function <codeph>F()</codeph> in class <codeph>CMyClass</codeph>,
       
    17 takes a <codeph>TInt</codeph> argument which must always be zero or positive. </p>
       
    18 <codeblock id="GUID-21213FE1-90B2-5218-BD0C-E2D598962AD6" xml:space="preserve">void CMyClass::F(TInt aValue)
       
    19  {
       
    20  _LIT(KMyPanicDescriptor, "My panic text");
       
    21 
       
    22  __ASSERT_ALWAYS(aValue &gt;= 0,User::Panic(KMyPanicDescriptor, aValue));
       
    23  ...
       
    24  /* main body of the function */
       
    25  ...
       
    26  }</codeblock>
       
    27 <p>If the caller passes a value which is negative, the current thread is panicked. </p>
       
    28 </conbody></concept>