Last change
on this file since 805 was 805, checked in by bird, 22 years ago |
Testcase for var/param hiding.
|
-
Property cvs2svn:cvs-rev
set to
1.2
-
Property svn:eol-style
set to
native
-
Property svn:executable
set to
*
-
Property svn:keywords
set to
Author Date Id Revision
|
File size:
1.4 KB
|
Line | |
---|
1 | /* $Id: boolparam.cpp 805 2003-10-05 04:05:47Z 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 | * Copyright (c) 2003 knut st. osmundsen <bird-srcspam@anduin.net>
|
---|
10 | *
|
---|
11 | *
|
---|
12 | * This program is free software; you can redistribute it and/or modify
|
---|
13 | * it under the terms of the GNU General Public License as published by
|
---|
14 | * the Free Software Foundation; either version 2 of the License, or
|
---|
15 | * (at your option) any later version.
|
---|
16 | *
|
---|
17 | * This program is distributed in the hope that it will be useful,
|
---|
18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
20 | * GNU General Public License for more details.
|
---|
21 | *
|
---|
22 | * You should have received a copy of the GNU General Public License
|
---|
23 | * along with This program; if not, write to the Free Software
|
---|
24 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
---|
25 | *
|
---|
26 | */
|
---|
27 |
|
---|
28 | #ifdef __IBMCPP__
|
---|
29 | typedef char bool;
|
---|
30 | #define false 0
|
---|
31 | #define true 1
|
---|
32 | #endif
|
---|
33 |
|
---|
34 | bool foo(bool f1, bool f2)
|
---|
35 | {
|
---|
36 | f1 = true;
|
---|
37 | f1 = false;
|
---|
38 | f2 = false;
|
---|
39 | f2 = true;
|
---|
40 | return f2 && !f1;
|
---|
41 | }
|
---|
42 |
|
---|
43 | bool bar(int i)
|
---|
44 | {
|
---|
45 | {
|
---|
46 | int i = 1;
|
---|
47 | i++;
|
---|
48 | i++;
|
---|
49 | i++;
|
---|
50 | i *= 2;
|
---|
51 | return i;
|
---|
52 | }
|
---|
53 | }
|
---|
54 |
|
---|
55 | int main()
|
---|
56 | {
|
---|
57 | int rc = !foo(false, true);
|
---|
58 | if (!bar(0))
|
---|
59 | rc = -1;
|
---|
60 | return rc;
|
---|
61 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.