- www.linkedin.com/in/fededp
- in/fededp
This file contains hidden or 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
#include <stdio.h> | |
#include <stddef.h> | |
#include <string.h> | |
/* | |
* PROs: | |
* * can have variables too as interface members | |
* | |
* CONs: | |
* * INTERFACE type can be directly declared and used as a normal struct |
This file contains hidden or 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
#include <stdio.h> | |
#include <stddef.h> | |
#include <stdint.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#define MyPtrTypeOf(TYPE, MEMBER) typeof(&((TYPE *)0)->MEMBER) | |
#define GetPtr(t, i, MEMBER) \ | |
MyPtrTypeOf(typeof(*t), MEMBER) MEMBER = \ | |
(MyPtrTypeOf(typeof(*t), MEMBER)) ((void *)(t + i) + offsetof(typeof(*t), MEMBER)) |
This file contains hidden or 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
#include <stdio.h> | |
#include <string.h> | |
#include <time.h> | |
#include <stdlib.h> | |
#define X_FIELDS \ | |
X(char *, field1) \ | |
X(char *, field2) \ | |
X(char *, field3) \ | |
X(char *, field4) \ |