How do I determine the memory offset of a type's field?


#1

Let’s say I have a custom composite type:

struct Foo
    bar::Int
    biz::Float64
end

While in this simple case, I can easily calculate the offset of biz myself (8 bytes), is there a function that will do this for me in a more generic way? Something akin to C’s offsetof macro?


#2

Just found it: fieldoffset