This is the mail archive of the
mailing list for the eCos project.
Re: Re: Typo in assert error message causing confusion?
- From: Stanislav Meduna <stano at meduna dot org>
- To: ecos-discuss at ecos dot sourceware dot org
- Date: Wed, 02 Oct 2013 14:00:13 +0200
- Subject: Re: Re: Typo in assert error message causing confusion?
- Authentication-results: sourceware.org; auth=none
- References: <1380618091882-245807 dot post at n7 dot nabble dot com> <B1E5ED67-1FE7-43FF-B3A3-E37D58D8A3E8 at linear dot com> <1380713171328-245957 dot post at n7 dot nabble dot com>
On 02.10.2013 13:26, Daniel Zebralla wrote:
> I get your point of view. However, I assume that someone would like to know
> what's broken instead of what would be the case if the message would have
> not been displayed.
The original assert macro that is in use for decades does _not_
contain an explanatory text and outputs the expression itself.
See e.g. http://www.manpagez.com/man/3/assert/
I.e. if the programmer says "I am asserting that ptr != 0" and it
is not true, it writes that the assertion "ptr != 0" failed.
If the CYG_ASSERT follows this schema, it should definitely
print what was expected.
> If my system stops with a kernel panic and tells me
> "Pointer is valid" I would be like -> oO.
As Michael says, it should tell you something along the lines
Assertion "Pointer is valid" failed
which makes perfect sense.
See comments at the top of host/infra/cyg_ass.h - it indeed defines
it this way.
CYG_ASSERT( pcount > 0, "Number of probes should be > 0!" );
Unfortunaly the very same file then spoils it with
CYG_ASSERTCLASS( p, "Object at p is broken!" );
Anyway, an assertion is a developer tool catching situations
the developer thinks can never happen. As such they are not
expected to be interpreted by anyone not able to look up the
source code and investigate what exactly went wrong.
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss