-
-
Notifications
You must be signed in to change notification settings - Fork 67
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
split _chk and _unchecked at compile-time #48
Labels
Comments
rurban
added a commit
that referenced
this issue
Feb 27, 2018
Probe for static_assert in CXX11 or C11 If args are compile-time constants and satisfy a constant expr, call the func, otherwise produce a compile-time error. But static_assert cannot be used inside args, only as statement. See #48
rurban
added a commit
that referenced
this issue
Feb 27, 2018
skip run-time checks when already checked at compile-time. split functions into two: unchecked and checked, depending on the already done compile-time check. currently only useful for clang-5+ gcc cannot not handle BOS as compile-time constant, how lame. shaves off 10% p_memcpy_s, when all 4 args are of known size + constant len. See #48
rurban
added a commit
that referenced
this issue
Feb 27, 2018
no _real, static inline _unchecked worker, and 2 exported funcs: _s (already checked) and _s_chk (some unchecked, deferred to run-time checks) See #48
rurban
added a commit
that referenced
this issue
Feb 27, 2018
Probe for static_assert in CXX11 or C11 If args are compile-time constants and satisfy a constant expr, call the func, otherwise produce a compile-time error. But static_assert cannot be used inside args, only as statement. See #48
rurban
added a commit
that referenced
this issue
Feb 27, 2018
skip run-time checks when already checked at compile-time. split functions into two: unchecked and checked, depending on the already done compile-time check. currently only useful for clang-5+ gcc cannot not handle BOS as compile-time constant, how lame. shaves off 10% p_memcpy_s, when all 4 args are of known size + constant len. See #48
rurban
added a commit
that referenced
this issue
Feb 27, 2018
no _real, static inline _unchecked worker, and 2 exported funcs: _s (already checked) and _s_chk (some unchecked, deferred to run-time checks) See #48
rurban
added a commit
that referenced
this issue
Feb 28, 2018
Probe for static_assert in CXX11 or C11 If args are compile-time constants and satisfy a constant expr, call the func, otherwise produce a compile-time error. But static_assert cannot be used inside args, only as statement. See #48
rurban
added a commit
that referenced
this issue
Feb 28, 2018
skip run-time checks when already checked at compile-time. split functions into two: unchecked and checked, depending on the already done compile-time check. currently only useful for clang-5+ gcc cannot not handle BOS as compile-time constant, how lame. shaves off 10% p_memcpy_s, when all 4 args are of known size + constant len. See #48
rurban
added a commit
that referenced
this issue
Feb 28, 2018
no _real, static inline _unchecked worker, and 2 exported funcs: _s (already checked) and _s_chk (some unchecked, deferred to run-time checks) See #48
rurban
added a commit
that referenced
this issue
Mar 8, 2024
Probe for static_assert in CXX11 or C11 If args are compile-time constants and satisfy a constant expr, call the func, otherwise produce a compile-time error. But static_assert cannot be used inside args, only as statement. See #48
rurban
added a commit
that referenced
this issue
Mar 8, 2024
skip run-time checks when already checked at compile-time. split functions into two: unchecked and checked, depending on the already done compile-time check. currently only useful for clang-5+ gcc cannot not handle BOS as compile-time constant, how lame. shaves off 10% p_memcpy_s, when all 4 args are of known size + constant len. See #48
rurban
added a commit
that referenced
this issue
Mar 8, 2024
no _real, static inline _unchecked worker, and 2 exported funcs: _s (already checked) and _s_chk (some unchecked, deferred to run-time checks) See #48
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
with all or most arguments already checked at compile-time, we can split up the function into a fast unchecked worker (evtl. even using the unsafe variant without _s), and the slow _chk function, which does the preliminary arg checks of those args which are not known at compile-time. currently for clang-5+ only.
memcpy_s is 10% faster if all 4 args are known, and the _chk function can be bypassed.
evtl. using static_assert for gcc, which does not have diagnose_if.
we need both, diagnose_if from #40 to be able to test it, by changing error to warning via -DTEST_BOS and the tests-bos target.
we cannot test the static assertions via gcc.
gcc has several limitations over clang:
The text was updated successfully, but these errors were encountered: