-
-
Notifications
You must be signed in to change notification settings - Fork 262
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
remove or de-UB --release from the CLI #4709
Comments
+1, kill it with fire. It's not only useless, but harmful to code that relies on well-defined behaviour. Let dmd continue with whatever mistakes it wants, we can do better with LDC. |
Alternatively, make --release an alias to -O3 and not remove asserts. In fact, this might be the better choice... It will fix the problem without breaking anyone's build! |
I'm not convinced - it's the analogon to C's |
I don't quite understand the vendetta against |
Yeah agreed, the name surely isn't ideal. But it's been there for ages, so at least for backwards compatibility, it would need to remain for quite a while anyway. Dub using it by default for all |
This is the biggest problem. People think they should use this for when they release their project. But there is no requirement to release with all asserts turned off. Especially bounds checks. I'd also be fine with a rename to something like
This is also a valid path. Just something where people can't accidentally trip on this footgun. Another further option is to still remove some things (invariant calls are probably not something you want to always have on), but keep bounds checks and asserts. It should just not be easy to turn all the safeties off. You should have to work at it, and understand what you are disabling. On the subject of dub, I think also it should be possible to build dependencies with different options for safety than the main project, which you might want to keep all checks.
That's a terrible name also, but not as inviting as |
This comes from helping many people on discord/d.learn who think they should use this switch to release their code, then have issues with UB. As an example, one user said they "didn't know why" but their project only worked in release mode. Why? Because it was corrupting memory, and not crashing right away! |
I wonder where they get that from. You have to actively search for We could remove "Compile release version" because that has no unambiguous meaning, but otherwise I think we should keep it. Similarly, |
https://learn.microsoft.com/en-us/visualstudio/ide/understanding-build-configurations?view=vs-2022 In other words, this is standard terminology in most IDEs |
How about |
Yes. And it is not unique to IDEs.
|
How about having |
I forgot to post that CMake |
See my post here: https://forum.dlang.org/post/pkeasakdbugctqdyetnw@forum.dlang.org
Just, remove the --release flag. It's completely useless, and does nothing to win benchmarks.
In fact, we pretty much "won" a benchmark here without -release: https://github.com/jinyus/related_post_gen/blob/main/d_v2/dub.json
The main drawback of the --release flag is that it seems to suggest when you release your D code you should use it. This is completely wrong.
Alternatively, we could alias --release to mean -O3, to avoid removing the UB that comes with removing bounds checks and asserts.
There is nothing that says we have to copy DMD's mistakes...
The text was updated successfully, but these errors were encountered: