Union pragma
The union pragma can be applied to any object type. It means all of an object’s fields are overlaid in memory. This produces a union instead of a struct in the generated C/C++ code. The object declaration then must not use inheritance or any GC’ed memory but this is currently not checked.
Future directions: GC’ed memory should be allowed in unions and the GC should scan unions conservatively.
当前内容版权归 nim-lang.org 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 nim-lang.org .