examples/after/source1.cpp
changeset 0 fe474e3b08fb
equal deleted inserted replaced
-1:000000000000 0:fe474e3b08fb
       
     1 // Copyright (c) 2010 Symbian Foundation Ltd.
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of the License "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Symbian Foundation - Initial contribution
       
    10 // 
       
    11 // Description:
       
    12 // Examples of things which GCC does not like in the Symbian codebase.
       
    13 // See the corresponding file in "after" for the preferred way to do it
       
    14 
       
    15 // Over-qualified class names
       
    16 
       
    17 #include "example_classes.h"
       
    18 
       
    19 TClass1::TClass1(int a, int b)
       
    20 	: iA(a), iB(b)
       
    21 	{}
       
    22 
       
    23 int TClass1::Average()
       
    24 	{
       
    25 	return (iA+iB)/2;
       
    26 	}
       
    27 
       
    28 int helper1(int a)
       
    29 	{
       
    30 	TClass1 c(a,11);
       
    31 	return c.Average();
       
    32 	}
       
    33 
       
    34 
       
    35 //-------------------------
       
    36 // Helper function to avoid things being optimised away
       
    37 int source1(void)
       
    38 	{
       
    39 	extern int unknown(void);
       
    40 	return helper1(unknown());
       
    41 	}