Added a INIT() macro to initialize class instances
This commit is contained in:
@@ -108,6 +108,12 @@
|
|||||||
*/
|
*/
|
||||||
#define POS printf("%s, line %d\n", __FILE__, __LINE__)
|
#define POS printf("%s, line %d\n", __FILE__, __LINE__)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Object allocation/initialization macro, using designated initializer.
|
||||||
|
*/
|
||||||
|
#define INIT(this, ...) { (this) = malloc(sizeof(*this)); \
|
||||||
|
*(this) = (typeof(*this)){ __VA_ARGS__ }; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Macro to allocate a sized type.
|
* Macro to allocate a sized type.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user