-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Enable NDEBUG by default in release builds? #2566
Comments
I'd imagine most distros use the |
I would be in favour of this. |
This changes what most people would expect, namely that release binaries don't contain any |
Except... there are many people who also keep assert() enabled in release builds. |
I guess, however, I fall into the "plain" camp and pick my own flags in this case. |
@phillipjohnston could you elaborate? What projects want I guess the issue boils down to the vision of meson: does it want to be like autoconf (a low-level, roll-your-own Makefile generator) or like CMake/QMake/python distutils (a higher-level tool to help library developers get their work done with reasonable defaults). |
Before I spend my time, is this comment a real request for my insight? The "What projects" seems combative enough - as if I could name them all. How many examples would satisfy you? The Pragmatic Programmer included "Leave Assertions Turned On" in 1999, I am hardly the only person with this idea. |
Since 1999 much has been learned. One thing that has thankfully become more accepted is that default values should reasonably help users, where the feeling used to be that defaults should provide a minimal experience. I don't think meson should prevent setting/unsetting values, but the question is what defaults should be provided out of the box.
Yes. I see across the build-tool landscape that |
A more interesting question to me, personally, is: Considering this can be controlled in project(..., default_options: ['b_ndebug=...']) Projects that dislike the meson default can always choose which approach they prefer. The downside of this is they have to know it's an important consideration to have. So, which one is a better default? Should the people that like release assertions have to know they need to configure them, or should the people that hate release assertions have to know they need to configure them? I genuinely don't know the answer to this. :) |
And can we change the default without making people complain that it's a breaking change in a semver stable release of meson? For comparison, when it came to run_command with the check: kwarg defaulting to false, we just spammed everyone with a warning that the current default is bad and they should manually specify what they want. On the other hand, you can't fix run_command without editing the build files, but people who want the assertions back can just pass arguments to When coordinating meson 2.0 we should do what we've been threatening to do for a while, and drop the warning but make ... I think that there are far more projects which add a compiled language without specifying b_ndebug, than there are projects which use run_command |
Maybe the ship has sailed and this should be turned into a documentation/education issue. |
#1896 adds a new option for
b_ndebug
that would automatically define it for release builds. There's also some discussion if this should just be the default, but the PR doesn't touch that, so I thought that discussion could be continued in its own issue.Summary:
NDEBUG
is a C/C++ standardThe text was updated successfully, but these errors were encountered: