Compound literals allow one to write e.g.:
struct point { int x, y; };
extern void putpixel(const struct point *);
and later
putpixel(&(const struct point){ 1, 2 });
struct point pt = (const struct point){ 37, 42 };
Nice, but not useful much, right? I was amazed at Nikita's usage:
* [Safe variadic functions](http://nikitadanilov.blogspot.com/2005/07/vaargs-c99-compound-literals-safe.html)
* [Named (and optional) formal parameters](http://nikitadanilov.blogspot.com/2005/08/named-formals.html)
No comments:
Post a Comment