Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

is there an option to emit a warning on encountering ub?


That's impossible in the general case, but there are compiler warnings that try to help you catch as much as they can, use `-Wall` when building code, and there is runtime instrumentation `-fsanitize=undefined` to catch as much UB as possible without breaking the ABI. Also consider using `-fsanitize=address,undefined` while developing and `-fsanitize=thread` for threaded code. `-fsanitize=memory` is a bit difficult to deploy because you need all your libraries (except libc) to be built with it too, including your C++ standard library if you're building C++.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: