OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [gdb-5.0/] [gdb/] [testsuite/] [gdb.c++/] [method.cc] - Blame information for rev 1774

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 106 markom
// Class funk has a constructor and an ordinary method
2
// Test for CHFts23426
3
 
4
class funk
5
{
6
public:
7
  funk();
8
  void getFunky(int a, int b);
9
  int data_;
10
};
11
 
12
funk::funk()
13
  : data_(33)
14
{
15
}
16
 
17
void funk::getFunky(int a, int b)
18
{
19
  int res;
20
  res = a + b - data_;
21
  data_ = res;
22
}
23
 
24
// Class A has const and volatile methods
25
 
26
class A {
27
public:
28
  int x;
29
  int y;
30
  int foo (int arg);
31
  int bar (int arg) const;
32
  int baz (int arg, char c) volatile;
33
  int qux (int arg, float f) const volatile;
34
};
35
 
36
int A::foo (int arg)
37
{
38
  x += arg;
39
  return arg *2;
40
}
41
 
42
int A::bar (int arg) const
43
{
44
  return arg + 2 * x;
45
}
46
 
47
int A::baz (int arg, char c) volatile
48
{
49
  return arg - 2 * x + c;
50
}
51
 
52
int A::qux (int arg, float f) const volatile
53
{
54
  if (f > 0)
55
    return 2 * arg - x;
56
  else
57
    return 2 * arg + x;
58
}
59
 
60
 
61
int main()
62
{
63
  A a;
64
  int k;
65
 
66
  k = 10;
67
  a.x = k * 2;
68
 
69
  k = a.foo(13);
70
 
71
  k += a.bar(15);
72
 
73
  // Test for CHFts23426 follows
74
  funk f;
75
  f.getFunky(1, 2);
76
  return 0;
77
}
78
 
79
 
80
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.