Every story and comment from the Hacker News API, in a layout borrowed from 2001.
A comment on Be wary of functions which take several parameters of the same type. Parent comment
struct copy_args_s { char * src; size_t src#; char * dest; size_t dest#; }; int copy(struct copy_args_s args) { ... } int main() { copy((struct copy_args_s){ .src = "foo", .src_len = 3, .dst = "bar", .dst_len = 3 }); }
struct copy_args_s { char * src; size_t src#; char * dest; size_t dest#; }; int copy(struct copy_args_s args) { ... } #define copy(...) copy((struct copy_args_s){__VA_ARGS__}) int main() { copy(.src = "foo", .src_len = 3, .dst = "bar", .dst_len = 3); }
Stop! Put down the editor and step away from the compiler, please. No one wants to get hurt.