C cleverly uses the array feature to calculate the size of the structure at compile time

 C cleverly uses the array feature to calculate the size of the structure at compile time

struct test_struct {
	char a;
	short b;
	int c;      
	void *d;
};

char xxx[sizeof(struct rte_timer) == 12 ? 1 : -1];

Comments

Popular posts from this blog

Python Receiving and parse JSON Data via UDP protocol

ubus lua client method and event registration code demo/example