Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add static size checks #19

Open
DanRStevens opened this issue Mar 6, 2019 · 2 comments
Open

Add static size checks #19

DanRStevens opened this issue Mar 6, 2019 · 2 comments

Comments

@DanRStevens
Copy link
Member

Many structs and classes are designed to match the internal memory layout used in Outpost2.exe. As such, they are size and padding sensitive. We should add static_assert checks to ensure structs and classes have, at minimum, a size that matches what Outpost2.exe uses.

Particular attention should be paid to structs or classes that use varying size enums, such as map_id. Pull Request #17 touched on this.

A proposal for a helper macro is in Pull Request #18.

@Brett208
Copy link
Member

Can we sign this off now, or are there more structs to consider?

-Brett

@DanRStevens
Copy link
Member Author

A quick grep of the source shows there's still much more work to do. I'll probably try to complete this in sections.

Adding a space after "struct" helps filter some of the noise, and shows both struct definitions and the static size checks recently added. That gives a quick glance of what needs to be done. Should probably do this for classes too.

grep -rn "struct " *

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants