Hi Jan,

since mutable julia object require a type tag, they always require a pointer
and cannot be structurally inlined. The assertion would hold if both types
were declared `immutable`.

On Wed, Jan 14, 2015 at 11:22 AM, Jan Niklas Hasse <jha...@gmail.com> 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.
>

Reply via email to