Skip to content
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

Asserts don't work #4

Open
marcogalluzzi opened this issue Jul 22, 2018 · 2 comments
Open

Asserts don't work #4

marcogalluzzi opened this issue Jul 22, 2018 · 2 comments

Comments

@marcogalluzzi
Copy link

If you include "assert()" in the source code they don't seem to be evaluated. To reproduce the error just try assert(false). Nothing happens when executing.

@marcogalluzzi marcogalluzzi changed the title Asserts dont work Asserts don't work Jul 22, 2018
@krzyzanowskim
Copy link
Owner

This is because the source is compiled with optimization "-O", that disables assert
ref: https://blog.krzyzanowskim.com/2015/03/09/swift-asserts-the-missing-manual/

@marcogalluzzi
Copy link
Author

Of course, I didn't think about it. Thanks for clarifying.

However I would suggest to switch off optimization (-Onone) because the application is meant for people to "play" with Swift.
Another option would be to write a warning text about assert() not working.

Have a nice day

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants