Skip to content

Include information about type padding #7

@popcron

Description

@popcron

because c# has padding mechanisms for types, its possible for reading a value using precise byte positions wont actually give the correct value.

for example:

public struct Another
{
    public byte a;
    public float b;
    public Vector4 c;
    public uint d;
}

the field b wont be 1 byte away from start, but 4 bytes away. this is solved by forcing the struct to not be packed, or have an explicit layout. this workaround is only needed for tracing where a field would be at runtime, and so to avoid overriding layouts, storing the padding would be needed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions