Bug#123468: [Bug c/6906] warn about asserts with side effects
------- Additional Comments From mbp at sourcefrog dot net 2004-08-10 23:56 -------
It might be nice if there were a compile-time function similar to
__builtin_constant_p which checked whether an expression was free of
side-effects. One could then write
# define assert(expr) \
(__builtin_pure_p((expr)) ? _real_assert(expr) :
warning_assert_expr_not_pure())
So this would be true for things like
__builtin_pure_p(arry[0] == 0)
__builtin_pure_p(strlen(s) == 5)
assuming the functions had the right attributes.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=6906
------- You are receiving this mail because: -------
You reported the bug, or are watching the reporter.
Reply to: