[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Tinycc-devel] Small curiosity, re operator precedence.
From: |
Lostgallifreyan |
Subject: |
Re: [Tinycc-devel] Small curiosity, re operator precedence. |
Date: |
Thu, 12 Apr 2012 17:03:55 +0100 |
Paulo Henrique Torrens <address@hidden> wrote:
(12/04/2012 16:14)
>Yeah, != has bigger precedence, but look what you did: it is on the left side
>of the expression, so it wouldn't be a valid syntax that way. :)
This is true. :) But remember, I didn't know that at the time, so I decided to
try what amounts to this:
If 92 isn't equal to whatever resulted from copy after iteration...
Now that I know this shouldn't work when written as while(92!=*--o=*--i)
instead of while((*--o=*--i)!=92), it's odd that it compiles and runs as
decribed without a warning or error in TCC. (If all compilers did as TCC seems
to do I wouldn't mind, it makes just as good sense to me, but maybe just
because I don't know enough about the implications if assignment was getting
the higher priority as it appears here).
>Probably GCC just skips this syntax, and I'm not sure if the second option
>(seeing the *--o = *--i as the right side) is invalid in an ANSI application,
>but TCC's accepting it would be like an "extension", ain't it? I think this
>couldn't be seem as a bug... but yeah, probably this is worth a compiler
>warning.
>
At least... :) I did consider the direction of reading, but I thought that it
wouldn't matter in this case so long as the comparison took priority over the
assignment as it should.
>
>
>Sorry for the last reply, my answer didn't much make sense... I've read it
>quickly from my cellphone, didn't pay much attention.
>
No problem. Any attention is better than none. I think this might be less
simple than it looks anyway, like a lot of logical problems.