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 a template overload of 'readUnitName' #49

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Pharap
Copy link
Contributor

@Pharap Pharap commented Apr 21, 2020

This template function is provided as a convinience to help users to avoid potential buffer overrun errors at compile time.
It performs a static_assert to check if the provided char array is large enough to receive the unit name.
There should be no additional cost as the template simply calls the other readUnitName overload (and thus should always be inlined).

This template function is provided as a convinience to help users to avoid potential buffer overrun errors at compile time.
It performs a `static_assert` to check if the provided `char` array is large enough to receive the unit name.
There should be no additional cost as the template simply calls the other `readUnitName` overload (and thus should always be inlined).
@Pharap
Copy link
Contributor Author

Pharap commented Apr 21, 2020

This change isn't quite backwards compatible because it may cause compile-time errors for some programs,
but any code it causes errors for would already potentially have runtime bugs due to buffer overflow errors.

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

Successfully merging this pull request may close these issues.

1 participant