>
> Are only transitively immutable types stored inline?

Yes. You can check `isbits(T)`, which in this case returns false because
`B.pointerfree == false`.


> Is this documented
> anywhere?


Unfortunately, the only hint at the moment appears to be
http://docs.julialang.org/en/release-0.4/devdocs/reflection/?highlight=isbits

and probably a number of mailing list questions.

The statement there remains true: if you are worried about C-compatible
layout, check whether the type is `isbits`.

On Mon, Jan 4, 2016 at 7:15 PM, Jamie Brandon <[email protected]>
wrote:

> This surprised me:
>
> immutable A
>   a::UInt32
>   b::UInt32
>   c::UInt64
>   d::UInt64
> end
>
> sizeof(A[A(0,0,0,0), A(0,0,0,0)]) # 48
>
> immutable B
>   a::UInt32
>   b::UInt32
>   c::Vector{UInt64}
>   d::Vector{UInt64}
> end
>
> sizeof(B[B(0,0,[],[]), B(0,0,[],[])]) # 16
>
> I expected the latter to also have size 48 ie 2xInt32, 2xPointer. Are
> only transitively immutable types stored inline? Is this documented
> anywhere?
>

Reply via email to