If you can, use immutable B x::A end
The "type" version contains a reference to an A, not the entire A structure itself. The C analog of what you were doing would be struct B { A* x; }; which of course doesn't have the same size as A. --Tim On Wednesday, January 14, 2015 02:22:19 AM Jan Niklas Hasse wrote: > Hi! > > I'm new to Julia and was wondering why > > type A > x::Ptr{Void} > y::Ptr{Void} > end > > type B > x::A > end > > assert(sizeof(A) == sizeof(B)) > > doesn't work while the C version > > #include <assert.h> > > struct A { > void* x; > void* y; > }; > > struct B { > A x; > }; > > int main() { > assert(sizeof(A) == sizeof(B)); > } > > does? This causes a segfault in my FreeType.jl wrapper.