Re: Can A Macro Do This?



Barry Schwarz wrote:
On Wed, 28 Nov 2007 16:45:40 +0100, Björn Paetzel <news@xxxxxxxxxx>
wrote:

santosh schrieb:

How can foo be 3 different things at the same time as in the
original code???
>>>> assert(foo==X);
>>>> assert(foo==Y);
>>>> assert(foo==Z);

That can't be right!
Yes. The sequence of assert invocations as presented seem redundant. Of
course some code could occur between the calls or the OP might have
just presented this as an example to enquire about writing complex
expressions with assert.
Maybe he wanted to something like this:

assert(foo==X==Y==Z);

/* ;) */

Since == is not transitive in the same sense = is, it seems unlikely.

A relation R is transitive if a R b && b R c implies a R c for all a,b,c. I believe this applies to == and it's even appropriate for = because it isn't a relation.
.



Relevant Pages

  • Re: Can A Macro Do This?
    ... The sequence of assert invocations as presented seem redundant. ... intuitive meaning of the expression should be TRUE but foo == X ...
    (comp.lang.c)
  • Re: Can A Macro Do This?
    ... Philip Potter wrote: ... The sequence of assert invocations as presented seem redundant. ...
    (comp.lang.c)
  • Re: Can A Macro Do This?
    ... Barry Schwarz wrote: ... The sequence of assert invocations as presented seem redundant. ...
    (comp.lang.c)
  • Re: Can A Macro Do This?
    ... Barry Schwarz wrote: ... The sequence of assert invocations as presented seem redundant. ...
    (comp.lang.c)
  • Re: Can A Macro Do This?
    ... The sequence of assert invocations as presented seem redundant. ... Remove del for email ...
    (comp.lang.c)