This is the mail archive of the
mailing list for the newlib project.
Re: Remove noreturn attribute for __assert_func on embedded build
- From: Freddie Chopin <freddie_chopin at op dot pl>
- To: newlib at sourceware dot org
- Date: Fri, 07 Feb 2014 16:29:26 +0100
- Subject: Re: Remove noreturn attribute for __assert_func on embedded build
- Authentication-results: sourceware.org; auth=none
- References: <52F33770 dot 9080208 at wp dot pl> <8A6D8E6D161CD644B982513286072E8D0B64FFB7 at DEFTHW99EJ1MSX dot ww902 dot siemens dot net> <52F49D61 dot 4030405 at wp dot pl>
W dniu 2014-02-07 09:46, PaweÅ pisze:
Do not take me wrong, I am not insist about this, but this was my
observation when I had to refactor whole my code to provide custom,
nonstandard assert() macro to show when my code is failing becouse stack
trace was broken.
1. There's nothing stopping you from having your own assert.h header
without the attribute
2. If your assert() is not standard, than it is not an assert() - you
should name it differently (debug_assert()? conditional_assert()?) and
use it for the purpose you described
I'm also an embedded developer, but I don't have anything against
noreturn attribute of assert() - if the assert fails (for example
because of nullptr dereferencing) then what's the point of returning?
assert() is not a substitution for a breakpoint of a debug output...