Re: [cc65] glitch in "assert.h" ?

Date view Thread view Subject view

From: Ullrich von Bassewitz (
Date: 2002-09-18 22:29:20


On Sat, Jul 27, 2002 at 11:23:45PM +0200, groepaz wrote:
> while brosing throug a couple of standard references (bzw can you
> suggest some decent url? ;=P too much outdated and/or unconfirmed
> stuff around it seems ;=P) i noticed the following....
> "Note that assert must expand to a void expression, so the more
> obvious if-statement does not suffice as a definition of
> assert."

Admittedly, it took some time, but it is fixed now:-)

I've added another change that allows the ?: operator to take two arguments of
type void (which was not possible before).

> in the "small" source there are a lof sanity checks in the form
> assert((sizeof(char)==1);
> that is, the expression passed to assert is actually constant, can be
> computed at compile-time, and is true - ultimativly resulting in an
> "unreachable code" warning for each of those assertions that doesnt
> fail. hrm, now the question is, is there a way to get rid of these
> warnings without disabling the specific warning completely? (there
> might be other places in the code were this warning is triggered not
> by assertions) ... i actually think the above macro should result into
> this behaviour...mmmh

The only fix I can think of is using "cc65 -DNDEBUG":-)

More seriously: No. cc65 is not smart enough to distinguish between
intentional and non intentional cases where the result of an expression is
constant. Even gcc gets this wrong sometimes...


        Uz (glad to be able to remove a few more old mails from his mailbox)

Ullrich von Bassewitz                        
To unsubscribe from the list send mail to with
the string "unsubscribe cc65" in the body(!) of the mail.

Date view Thread view Subject view

This archive was generated by hypermail 2.1.3 : 2002-09-18 22:30:15 CEST