[ create a new paste ] login | about

Link: http://codepad.org/1cFn18oh    [ raw code | output | fork ]

C++, pasted on May 10:
1
2
3
4
5
6
7
8
9
10
11
12
13
// our header.h which is used by entire program
struct ZeStruct;
int ZeStruct_x(ZeStruct* z);

// some library which we want to hide from the world
struct ConcreteZeStruct { int x; };

// implementation that tries to hide ConcreteZeStruct behind ZeStruct?
typedef struct ConcreteZeStruct ZeStruct;

int ZeStruct_x(ZeStruct* z){
  return z->x;
}


Output:
1
2
Line 9: error: conflicting declaration 'typedef struct ConcreteZeStruct ZeStruct'
compilation terminated due to -Wfatal-errors.


Create a new paste based on this one


Comments: