Re:Fewer mallocs in curl
by wbl on Sunday April 23, 2017 @02:37PM
(#14179621)
One of the Plan 9 C enhancements makes this even easier by permitting the fields of these structs to be accessed directly.
[ Parent
| on HN ]
Re:Fewer mallocs in curl
by generic_user on Monday April 24, 2017 @03:39AM
(#14182539)
you can do this now in ISO C11 with the inclusion of anaonomous structures and unions.
struct A {
int x, y;
};
struct B {
union {
struct A 2d;
struct { int x, y; };
}
int z;
};
...
struct B foo;
foo.x = foo.2d.y = foo.z = 0;
you can access x and y as members of B or A.