1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155
|
// include
#include "included.h"
// macro
#define PRINT(string,msg) printf(string, msg)
//namespace
namespace MyPackage
{
// check class
// class
class Hello
{
// protected visibility
protected:
// field
int x;
// method
inline void setX(int X)
{
x = X;
};
// check nested pachage
// nested namespace
namespace MyNestedPackage {
// check parent nested class
// nested class
class Y
{ // public visibility
public:
// constructor
Y();
// virtual destructor
virtual ~Y();
};
// check derived nested class
// derived class
class X : public Y {
// private visibility
private:
// private field
B b;
public:
// constructor chain
X(int x) : Y(x) {
cout << "In consturctor\n";
}
// method declaration
int doNothing();
};
}
};
// check enums
// enum without name
enum {
first = 1,
second,
third
}
;
// enum with name
enum MyEnum {
f,
s,
t };
// check variables
// variable
int v;
// unsigned long variable
unsigned long vuLong;
// unsigned short variable
unsigned short vuShort;
// check variable declarations
// variable declaration
extern int evar;
// function pointer
static void * (*orig_malloc_hook)(const char *file, int line, size_t size);
// check functions
// simple function declaration
void foo();
// function declaration with parameters
char* foo(int& x,
char**y);
// simple function definition
void boo(){
int g = 0;
};
// check Structs
// struct
struct MyStruct{
int sint;
};
// typedef and elaborated types
typedef struct MyStruct myStruct;
// typedef
typedef struct{
int ss;
} myTypedef;
// unions
union U{
int U1;
};
// check templates
// template function declaration
template<class A, typename B=C>
A aTemplatedFunction( B bInstance );
// template function definition
template<class A, typename B=C>
A aTemplatedFunction( B bInstance ) {
A a;
return a;
}
// template method
class enclosing {
// public visibility
public:
template<class A, typename B=C>
A aTemplatedMethod( B bInstance );
};
// template class
template<class T, typename Tibor = junk>
class myarray { /* */ };
// template struct
template<class T, typename Tibor = junk>
struct mystruct { /* */ };
// template variable
template <bool __threads, int __inst>
char* default_alloc_template<__threads, __inst>::_S_start_free = 0;
};
// check arrays
// arrays
int myArray [5][];
int main(int argc, char * argv[])
{
}
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=180815
struct bug180815 {
int i,j;
} bug180815_var0, bug180815_var1;
// using
using Mypackage;
// linkage spec
extern "C" {
void cfunction() {}
}
|