GNOME Bugzilla – Bug 597999
Inconsistent treating of assertions
Last modified: 2018-05-22 13:23:59 UTC
IMO there should be one, unified way of getting rid of assertions in code, when compiling. Now it looks like this: 1) all assertions (implicit & explicitly declared by assert()) are compiled in by default 2) --disable-assert disables only implicit assertions 3) to disable assert(), you CAN'T DO THIS AT THE VALA LEVEL. You must pass "-X -DG_DISABLE_ASSERT", and assertions will be disabled by the C compiler. Asssertions are commonly used to check constrains in debug versions, I know that Glib gives them slightly different role, but there should be some way of debug-version-only asserting. A little offtopic: My proposition would be even to introduce keyword "debug" with syntax: debug { //statements } And the debug block would be compiled into program only in debug builds.
I agree that a device like that for debugging would be helpful. I'm not sure whether a dedicated keyword is not too intrusive. I'm with you on the subject of adding something to remove assert() creation at the Vala level though.
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/vala/issues/49.