<div style="white-space:pre-wrap">True. I was thinking to much in the content of the stdlib only but with a builtin you can get things optimized away.</div><br><div class="gmail_quote"><div dir="ltr">On Tue, Mar 15, 2016 at 9:22 AM Dmitri Gribenko <<a href="mailto:gribozavr@gmail.com">gribozavr@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">A function can absolutely can do that, if it is implemented using a<br>
builtin known to the optimizer.<br>
<br>
Dmitri<br>
<br>
On Tue, Mar 15, 2016 at 9:20 AM, Shawn Erickson <<a href="mailto:shawnce@gmail.com" target="_blank">shawnce@gmail.com</a>> wrote:<br>
> You would likely want to ensure debug related code could be optimized away /<br>
> or not be included in release builds. I am not sure how a function would<br>
> achieve that.<br>
> On Tue, Mar 15, 2016 at 9:15 AM Erica Sadun via swift-evolution<br>
> <<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>> wrote:<br>
>><br>
>><br>
>><br>
>> On Mar 14, 2016, at 2:04 PM, Dmitri Gribenko <<a href="mailto:gribozavr@gmail.com" target="_blank">gribozavr@gmail.com</a>> wrote:<br>
>> Hi Erica,<br>
>><br>
>> Based on Joe's rationale that you are quoting, I think the intent is<br>
>> that we want to restrict this directive to be statement-level only.<br>
>> The API vended by a module should not be affected by the build mode.<br>
>><br>
>> Dmitri<br>
>><br>
>><br>
>><br>
>> Could the debug build test take the form of a standard non-private<br>
>> function then<br>
>> instead of _isDebugAssertConfiguration()? If the test is limited to<br>
>> methods,<br>
>> introducing #if-style tests would be ugly.<br>
>><br>
>> How likely or easy is it for me to reframe the request for testing for<br>
>> debug to be as<br>
>> simple as:<br>
>><br>
>> `if debugBuild() {...}`<br>
>><br>
>> with `debugBuild` vended by the standard library instead of as a build<br>
>> configuration test?<br>
>><br>
>> -- E<br>
>><br>
>> _______________________________________________<br>
>> swift-evolution mailing list<br>
>> <a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br>
>> <a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
<br>
<br>
<br>
--<br>
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if<br>
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <<a href="mailto:gribozavr@gmail.com" target="_blank">gribozavr@gmail.com</a>>*/<br>
</blockquote></div>