Created
January 18, 2017 20:02
-
-
Save RElesgoe/e39e39b136e27b2393618b8fee7f3866 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// clang++ -std=c++11 -stdlib=libc++ main.cpp | |
/* clang --version | |
* clang version 3.8.0-2ubuntu3~trusty4 (tags/RELEASE_380/final) | |
*/ | |
/* lsb_release -a | |
* No LSB modules are available. | |
* Distributor ID: Ubuntu | |
* Description: Ubuntu 14.04.5 LTS | |
* Release: 14.04 | |
* Codename: trusty | |
*/ | |
#include <cstddef> | |
#define elist_entry(ptr, type, member) ((type*)(((char*)ptr)-offsetof(type, member))) | |
typedef struct elist_struct { | |
struct elist_struct *next, *prev; | |
} t_elist; | |
typedef struct { | |
t_elist refs_link; | |
} t_rcm_regref; | |
int main() | |
{ | |
char a[] = "Hello World"; | |
char* b = a; | |
t_rcm_regref* c = elist_entry(b, t_rcm_regref, refs_link); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
main.cpp:31:35: error: unexpected type name 't_rcm_regref': expected expression
main.cpp:31:49: error: use of undeclared identifier 'refs_link'