Quiting a program using pure C

D

Daniel Vallstrom

Dan said:

[snip discussion about having assert() take a bool argument]
Fortunately, because the vast majority of assert() arguments don't have
bool type even when they are conceptually booleans. Would you like
writing assert((bool)(a == b)) instead of assert(a == b) ?

I just meant that if "assert(e)" was, in one way or another, stipulated

to mean "assert((bool)e)", then everything would still work. That is,
in C99, "assert(e)" is equivalent to "assert((bool)e)".

The good question is if there was/is any known C89 implementation where
assert(pointer) doesn't work as intuitively expected by its (mis)user.
To me, it looks like a bug in the C89 specification.
Agreed.


Daniel Vallstrom
 
D

Dan Pop

In said:
Dan said:

[snip discussion about having assert() take a bool argument]
Fortunately, because the vast majority of assert() arguments don't have
bool type even when they are conceptually booleans. Would you like
writing assert((bool)(a == b)) instead of assert(a == b) ?

I just meant that if "assert(e)" was, in one way or another, stipulated

to mean "assert((bool)e)", then everything would still work. That is,
in C99, "assert(e)" is equivalent to "assert((bool)e)".

So, why bother with such a stipulation? At the end of the day, you still
have to compare the result against zero...

Dan
 
D

Daniel Vallstrom

Dan said:
So, why bother with such a stipulation? At the end of the day, you still
have to compare the result against zero...

Right, there would be no point with such a stipulation.
My only point, in answer to posts higher up in this thread,
is that bool has all the properties one could wish for and
behaves well. (Of course, my replies weren't very to the
point. That they introduced errors of their own didn't help
either.)

Daniel Vallstrom
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,156
Messages
2,570,878
Members
47,408
Latest member
AlenaRay88

Latest Threads

Top