tinycc-devel
[Top][All Lists]
Advanced

[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 15:44:13 +0100

I think the pre/post -- bit is ok though, not got a problem with that. What 
seems wrong is that TCC looks like it's giving the assignment priority over the 
comparison, and according to Wikipedia, the comparison sould have WAY more 
priority (9 on list, with assignment right down at 16 on list). It's not the 
location of the incrementor that matters, I think, but the assignment of the 
dereferenced value itself. It clearly works after the decrement as desired, and 
I like the way TCC works, it's just that it appears to be wrong, and I want 
clarification. As it is, I can't do this with GCC, which acts in accordance 
with what Wikipedia says about this...

It seems to go beyond interpretations and implemetations of equal precedence, 
when one is as different from the other as 9 is from 16.


Paulo Henrique Torrens <address@hidden> wrote:
(12/04/2012 14:42)

>This is a "feature". Ansi C says that the post and preincrements order are 
>implementation defined. As it seems, there is something about the precedence 
>order of the ==, that problably is some optimization. In order to achieve 
>portability, separe it in some lines with the right order. But, yeah, that's 
>no bug. :)
>
>
>Lostgallifreyan <address@hidden> wrote:
>(31/03/2012 09:47)
>
>>Please ignore any 'unsafe' aspect this example might have, it IS bounded in 
>>the context I'm using it in....
>>
>>while((*--o=*--i)!=92)
>>
>>I was tryign to reduce stuff, so came up with this to try:
>>
>>while(92!=*--o=*--i)
>>
>>TCC loves it, GCC hates it. :)
>>
>>GCC thinks it's doing this: while((92!=*--o)=*--i) and therefore an invalid 
>>lvalue, which makes sense given what Wikipedia has to say about precedence, 
>>but TCC (still using v0.9.24 here) seems to do what I was wondering if it 
>>might do, to compare the dereferenced value when it is copied. I reverted to 
>>the original form because the more compilers take my code the happier I am 
>>about it, but I'm interested. Is this a bug, or a feature? :)
>>
>
>
>Rudolph Loew, maker of the 48 bit LBA patch for W98, amongst other things, 
>says this:
>
>It does appear to be a bug as far as I can tell.
>They should not be reinterpreting the precedence even if the intent can be 
>inferred.
>
>
>I'm losing my limited power to code, I think my brain is dying. Not kidding. 
>Not a coding problem so I'll say no more about it other than this: I cannot be 
>trusted to fix the code, even if I try, especially as I don't know enough 
>about TCC, and this needs to be looked at by someone working on TCC! You have 
>a choice of two base assumptions: Rudolph Loew's brain is also dying, or there 
>is a problem you need to check out.
>
>
>_______________________________________________
>Tinycc-devel mailing list
>address@hidden
>https://lists.nongnu.org/mailman/listinfo/tinycc-devel
>
>_______________________________________________
>Tinycc-devel mailing list
>address@hidden
>https://lists.nongnu.org/mailman/listinfo/tinycc-devel




reply via email to

[Prev in Thread] Current Thread [Next in Thread]