| Last change
 on this file since 1166 was             824, checked in by bird, 22 years ago | 
        
          | 
Correct copyright.
 | 
        
          | 
              
Property                 cvs2svn:cvs-rev
 set to                 1.3
Property                 svn:eol-style
 set to                 native
Property                 svn:executable
 set to                 *
Property                 svn:keywords
 set to                 Author Date Id Revision | 
        
          | File size:
            845 bytes | 
      
      
| Line |  | 
|---|
| 1 | /* $Id: boolparam.cpp 824 2003-10-08 19:30:03Z bird $ */ | 
|---|
| 2 | /** @file | 
|---|
| 3 | * | 
|---|
| 4 | * GCC does weird stuff in respect to the C++ bool type when passed as | 
|---|
| 5 | * a parameter. In this testcsae we should see the values changing in | 
|---|
| 6 | * variable monitor. The bool variables should be represented as if | 
|---|
| 7 | * enums with values true or false. | 
|---|
| 8 | * | 
|---|
| 9 | * InnoTek Systemberatung GmbH confidential | 
|---|
| 10 | * | 
|---|
| 11 | * Copyright (c) 2003 InnoTek Systemberatung GmbH | 
|---|
| 12 | * Author: knut st. osmundsen <bird-srcspam@anduin.net> | 
|---|
| 13 | * | 
|---|
| 14 | * All Rights Reserved | 
|---|
| 15 | */ | 
|---|
| 16 |  | 
|---|
| 17 | #ifdef __IBMCPP__ | 
|---|
| 18 | typedef char bool; | 
|---|
| 19 | #define false 0 | 
|---|
| 20 | #define true 1 | 
|---|
| 21 | #endif | 
|---|
| 22 |  | 
|---|
| 23 | bool foo(bool f1, bool f2) | 
|---|
| 24 | { | 
|---|
| 25 | f1 = true; | 
|---|
| 26 | f1 = false; | 
|---|
| 27 | f2 = false; | 
|---|
| 28 | f2 = true; | 
|---|
| 29 | return f2 && !f1; | 
|---|
| 30 | } | 
|---|
| 31 |  | 
|---|
| 32 | bool bar(int i) | 
|---|
| 33 | { | 
|---|
| 34 | { | 
|---|
| 35 | int i = 1; | 
|---|
| 36 | i++; | 
|---|
| 37 | i++; | 
|---|
| 38 | i++; | 
|---|
| 39 | i *= 2; | 
|---|
| 40 | return i; | 
|---|
| 41 | } | 
|---|
| 42 | } | 
|---|
| 43 |  | 
|---|
| 44 | int main() | 
|---|
| 45 | { | 
|---|
| 46 | int rc = !foo(false, true); | 
|---|
| 47 | if (!bar(0)) | 
|---|
| 48 | rc = -1; | 
|---|
| 49 | return rc; | 
|---|
| 50 | } | 
|---|
       
      
  Note:
 See   
TracBrowser
 for help on using the repository browser.