michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: extern "C" int mult(int l, int r); michael@0: michael@0: extern "C" { michael@0: michael@0: inline michael@0: int michael@0: farfle(int a, int b) michael@0: { michael@0: return a * b + a / b; michael@0: } michael@0: michael@0: static michael@0: int michael@0: ballywhoo(int a, int b) michael@0: { michael@0: // So it can't get inlined michael@0: if (a > 4) michael@0: ballywhoo(a - 1, a + 1); michael@0: michael@0: return a + b; michael@0: } michael@0: michael@0: static michael@0: int michael@0: blimpyburger(char a, int b) michael@0: { michael@0: if (a == 'f') michael@0: return b; michael@0: michael@0: return 0; michael@0: } michael@0: michael@0: } michael@0: michael@0: class foo michael@0: { michael@0: public: michael@0: static int get_flooby() { static int flooby = 12; return flooby; } michael@0: michael@0: static int divide(int a, int b); michael@0: michael@0: foo() {} michael@0: foo(int a); michael@0: virtual ~foo() {} michael@0: michael@0: int bar(); michael@0: michael@0: int baz(int a) { return a ? baz(a - 1) : 0; } michael@0: }; michael@0: michael@0: foo::foo(int a) michael@0: { michael@0: } michael@0: michael@0: int michael@0: foo::divide(int a, int b) michael@0: { michael@0: static int phlegm = 12; michael@0: return a / b * ++phlegm; michael@0: } michael@0: michael@0: int michael@0: foo::bar() michael@0: { michael@0: return 12; michael@0: } michael@0: michael@0: int main(int argc, char* argv[]) michael@0: { michael@0: int a = mult(5, 4); michael@0: a = ballywhoo(5, 2); michael@0: a = farfle(a, 6); michael@0: a = blimpyburger('q', 4); michael@0: michael@0: foo f; michael@0: f.get_flooby(); michael@0: a = f.bar(); michael@0: michael@0: a = foo::divide(a, 12) + f.baz(6); michael@0: michael@0: foo f2(12); michael@0: f2.baz(15); michael@0: michael@0: return a > 99 ? 1 : 0; michael@0: }