This is the mail archive of the mailing list for the eCos project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Re: Typo in assert error message causing confusion?

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.

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:
and search the list archive:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]