stosb

wearer of programming socks

  • she/her

mid 20s | bisexual | programmer | european


profile pic: a picrew by Shirazu Yomi
picrew.me/en/image_maker/207297
i use arch btw
xenia the linux fox -> ๐ŸฆŠ๐Ÿณ๏ธโ€โšง๏ธ
the moon
๐ŸŒ™

erysdren
@erysdren
#include <stdio.h>

struct _doThing {
	int x; int y;
};

void _doThing(struct _doThing options)
{
	printf("x=%d y=%d\n", options.x, options.y);
}

#define doThing(...) _doThing((struct _doThing){ __VA_ARGS__ })

int main(void)
{
	/* these are all equivalent */
	doThing(.x = 64, .y = 1);
	doThing(.y = 1, .x = 64);
	doThing(64, 1);

	return 0;
}

i tested this and it works with the most recent GCC and Clang installed on my system. feels cursed as hell, but i kinda like it actually. lol

thanks to @wavebeem for inspiring me to do this


You must log in to comment.

in reply to @erysdren's post: