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

Calculating the size of value types and ensuring compile-time optimization #77

Open
sirisian opened this issue Nov 28, 2022 · 0 comments

Comments

@sirisian
Copy link
Owner

sirisian commented Nov 28, 2022

A keyword or function that returns the number of bytes of an object. This would include class value types which have a fixed size.

Languages handle this slightly differently, but with similar results. C++ has a sizeof T keyword. C# has sizeof(T).

Since value types aren't Objects I find the idea of Object.size(...) or Object.size<T>() weird. Also I'd prefer more of a compile-time and runtime compatible method that is compiled away when applicable. Getting the size of uint8 for instance might be more readable than writing 1, but I'd hate if calculating the size had any performance implications.

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

No branches or pull requests

1 participant