public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
From: Stanislav Meduna <stano@meduna.org>
To: ecos-discuss@ecos.sourceware.org
Subject: Re: [ECOS] Re: Typo in assert error message causing confusion?
Date: Wed, 02 Oct 2013 12:00:00 -0000	[thread overview]
Message-ID: <524C0ACD.5090604@meduna.org> (raw)
In-Reply-To: <1380713171328-245957.post@n7.nabble.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.

-- 
                                      Stano


-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

      reply	other threads:[~2013-10-02 12:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-01  9:01 [ECOS] " Daniel Zebralla
2013-10-01 15:27 ` Michael Jones
2013-10-02 11:26   ` [ECOS] " Daniel Zebralla
2013-10-02 12:00     ` Stanislav Meduna [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=524C0ACD.5090604@meduna.org \
    --to=stano@meduna.org \
    --cc=ecos-discuss@ecos.sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).