Laur's blog
Sign in Subscribe

c++ assert

A collection of 1 post
Don't Use Assert() If You Don't Mean It (C++)
c++ assert

Don't Use Assert() If You Don't Mean It (C++)

I found the hard way that assert() in C/C++ exists hard. This post explains that you get a SIGABRT . So, if you want your code to be testable, you better throw an exception instead. I defined a LOGIC_ERROR(condition) macro: #define LOGIC_ERROR(e) if(!(e)) throw std:
Dec 26, 2015 1 min read
Page 1 of 1
Laur's blog © 2025
  • Sign up
Powered by Ghost